Recent

Author Topic: PageControl and its tabsheets events  (Read 9051 times)

asdf

  • Sr. Member
  • ****
  • Posts: 310
PageControl and its tabsheets events
« on: February 07, 2011, 11:33:56 am »
1. What are the differences of tabsheet events; OnShow, OnEnter or OnMouseEnter  :( ?

2. From the attached picture, PageControl is showing TabSheet3.
   What event is working with TabSheet4 while it is now 'behind' TabSheet3  :( ?

3. What is the proper event when user clicks on tab namely TabSheet4  :( ?
Lazarus 1.2.4 / Win 32 / THAILAND

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1931
Re: PageControl and its tabsheets events
« Reply #1 on: February 07, 2011, 11:40:47 am »
I don't really understand the questions, but I think you are looking for

TPageControl.OnChange. See this example:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.PageControl1Change(Sender: TObject);
  2. begin
  3.   Caption:=PageControl1.ActivePage.Caption;
  4. end;

ringo

  • New Member
  • *
  • Posts: 16
Re: PageControl and its tabsheets events
« Reply #2 on: February 08, 2011, 09:57:21 am »
OnShow will be fired whenever the tab page is "shown", that is, displayed.  It doesn't matter if it was shown due to a mouse click or programically.

OnEnter will be fired when you navigate into the page, whether it is via a mouse click or the tab key or any other means.

OnMouseEnter will be fired when to enter the tab page specifically by clicking the mouse.

I think Theo probably identified the event you are really looking for.

Ringo

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: PageControl and its tabsheets events
« Reply #3 on: February 14, 2011, 02:53:59 am »

OnShow will be fired whenever the tab page is "shown", that is, displayed.  It doesn't matter if it was shown due to a mouse click or programically.



Thank you, in design window, I sometimes forgot and saved the project with PageControl.TabIndex <> 0.
And for example, in some PageControls, TabIndex(TabSheet)2 has to wait until TabSheet1Show finishes. That's why compiling has error. Now I always put PageControl1.TabIndex:=0 .
Lazarus 1.2.4 / Win 32 / THAILAND

 

TinyPortal © 2005-2018