Главная страница | назад





Article #17044: Click a speed button in code

 Question and Answer Database

FAQ2044D.txt   Click a speed button in code
Category   :VCL
Platform    :All
Product    :All 32 bit  

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;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99