Search code examples
delphitpagecontrol

Detect tab change in PageControl


I have a PageControl on my form and i wish to detect when the user is selecting another tab.

How can i do this ? I am using Delphi 7.

I didn't find any event and waisting time developing my own pagecontrol is not exactly what i intend to do.


Solution

  • try this on show or create event of your form

     iThCrrntIndex:=PageControl1.TabIndex;  //the currently selected page
    

    then on PageControl1Change event or PageControl1Changing event check

       if   iThCrrntIndex=PageControl1.TabIndex then
            begin
         //same page
       end
     else
       begin
         //new page selected..
       end;