Author: Tomas Rutkauskas
How to find the TTabSheet in a pagecontrol, an active control is sitting on
Answer:
The forms ActiveControl property points to the active control on the form (if any,
it may be Nil under certain circumstances). If you want to find the tabsheet in a
pagecontrol, this controls is sitting on, you walk up its parent chain:
1 var2 ctrl: TWinControl;
3 begin4 if ActiveControl <> nilthen5 begin6 ctrl := ActiveControl.Parent;
7 while (ctrl <> nil) andnot (ctrl is TTabsheet) do8 ctrl := ctrl.parent;
9 if ctrl <> nilthen10 {... found the tabsheet, can cast it as TTabsheet( ctrl ) to access 11 its properties}