4

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.

opc0de
  • 11,557
  • 14
  • 94
  • 187
  • 1
    see http://stackoverflow.com/questions/8383659/delphi-how-to-allow-forbid-user-to-enter-tab-in-pagecontrol/8384240#comment10355286_8384240 – Ravaut123 Dec 30 '11 at 08:46

2 Answers2

4

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;  
PresleyDias
  • 3,657
  • 6
  • 36
  • 62
1

Try the OnChange and OnChanging events?

Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
Herbert Sitz
  • 21,858
  • 9
  • 50
  • 54
  • Those events happen when the user manually clicks to change the tabs. Not raised when the Page Control is 'programmatically' changed. – user30478 Mar 01 '21 at 10:54