Jump to content

Rapunzel

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Rapunzel

    TSpeedButton IsPressed issue

    Hello, you are right, I can reproduce the issue. I used a listbox to record the IsPressed status in three events. If you click quickly, you can see that the status in OnClick has not changed yet. You can use the OnMouseUp event instead. procedure TForm4.btnSpecialOnlyMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin if btnSpecialOnly.IsPressed then begin LB.Items.Add('MouseDown TRUE'); end else begin LB.Items.Add('MouseDown FALSE'); end; end; procedure TForm4.btnSpecialOnlyClick(Sender: TObject); begin Label1.Text:=FCount.ToString; Inc(FCount); if btnSpecialOnly.IsPressed then begin LB.Items.Add('Click TRUE'); end else begin LB.Items.Add('Click FALSE'); end; end; procedure TForm4.btnSpecialOnlyMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin if btnSpecialOnly.IsPressed then begin LB.Items.Add('MouseUp TRUE'); end else begin LB.Items.Add('MouseUp FALSE'); end; end;
×