- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Click a speed button in code

Question:

How can I click a SpeedButton component in code? I tried using SendMessage but it does not work since Speedbuttons do not have handles.

Answer:

The following example demonstrates using the Perform method

of TControl to send the message.



Example:



procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

  ShowMessage('clicked');

end;



procedure TForm1.Button1Click(Sender: TObject);

begin

  SpeedButton1.Perform(WM_LBUTTONDOWN, 0, 0);

  SpeedButton1.Perform(WM_LBUTTONUP, 0, 0);

end;




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile