Recent

Author Topic: [S]OnClick and similar events do not work for labels, when place on TPageControl  (Read 2812 times)

CM630

  • Hero Member
  • *****
  • Posts: 1402
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
I have put a label on the header of tab page (as seen on the attached image).
When I click on the label the OnClick (etc) events do not start. I have set Z-Order of the label to 'Move to Front'.
When I put a button on the same place, it works just fine. Unfortunately: 1. I could not find a FLAT property for the button  2. Buttons do not have a DoubleClick event, which I need , so this did not solve my problem, too.

Code: [Select]
procedure TForm1.Label1Click(Sender: TObject);
begin
  ShowMessage ('Label1');  //This does NOT work
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage ('button1'); //This works
end;

procedure TForm1.Label2Click(Sender: TObject);
begin
    ShowMessage ('Label2'); //This works
end; 


What other solution could exist?
« Last Edit: August 21, 2013, 01:24:15 pm by paskal »
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

Zoran

  • Hero Member
  • *****
  • Posts: 1949
    • http://wiki.lazarus.freepascal.org/User:Zoran
Try with TStaticText control (palette page "Additional").
The difference between TStaticText and TLabel is that TStaticText descends from TWinControl, so it can receive focus and it can stand in front of other WinControls (unlike TLabel, which cannot be brought in front of some WinControl).
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

CM630

  • Hero Member
  • *****
  • Posts: 1402
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Thanks, works okay!
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018