you know that is easy to find out right? just ctrl+click on the TLabel type in the declaration and it will take you to the class it self.
when i ctrl+click on the TLabel(or TEdit or TCombobox or TButton or
TCheckBox) ,the file
StdCtrls opens
and
when i ctrl+click on the TPanel ,the file
ExtCtrls opens
i don't know why Tlabel and TCheckBox are in one file (they are in the file StdCtrls), but this code work on TCheckBox and doesn't work on TLabel?!?!?You could add this method to your form, and connect it to the OnMouseDown events of the label, button and form.
procedure TForm1.SharedMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbRight) then begin
if (Sender is TLabel) then
ShowMessage(TLabel(Sender).Name)
else if (Sender is TButton) then
ShowMessage(TButton(Sender).Name)
else ShowMessage('You right-clicked but not on a label or button');
end;
end;
Note that ssRight (used in the code you showed) has nothing to do with which mouse button is pressed.
i know this code and i don't want to use this code(Thank you)
Note that ssRight (used in the code you showed) has nothing to do with which mouse button is pressed.
i don't know this ?!?!?!(Thank you)