Recent

Author Topic: [solved] adressing a grand-grand child pagecontrol's tabsheet  (Read 442 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1324
There is a
form1
it becomes the parent of a
frame1 at runtime
this frame1 is the parent of a
pagecontrol_Main at design-time.

In other words:
On startup the Form1 is generated, the Frames become children by code and all is fine.

Case I want to show the user a certain Tab-sheet, I write:
Form1.PageControl_Main.ActivePage:=Form1.TabSheet_1;

This works.
But!

What about the grand-childs?
If the PageControl_Main
got parent of a PageControl_Minor, which has a TabSheet_2.

How to set his tabsheet_2 to active?
So the generation would be this:
Form1
Frame1
PageControl_Main
TabSheet1
PageControl_Minor
TabSheet2

At the moment I call a method within the frame1 to do this activepage-setting.
This works fine.

However I cannot sleep because of thinking: There shall be a way to set  TabSheet_2 as activepage directly from everywhere?
« Last Edit: April 12, 2025, 07:30:52 am by Nicole »

wp

  • Hero Member
  • *****
  • Posts: 13556
Re: adressing a grand-grand child pagecontrol's tabsheet
« Reply #1 on: April 10, 2025, 07:07:44 pm »
Why don't you use the variable names? See attached mini project.

Nicole

  • Hero Member
  • *****
  • Posts: 1324
Re: adressing a grand-grand child pagecontrol's tabsheet
« Reply #2 on: April 12, 2025, 07:30:18 am »
This really works!
Thank you so much!
Now I can re-organize the tons of tabs which mess my app.

In my case there are 2 lines, which do it:
Code: Pascal  [Select][+][-]
  1. Form1.PageControl1.ActivePage:=Form1.TabSheet1;
  2. Frame1.PageControl1.ActivePage:=Frame1.TabSheet2;

for anybody finding this topic:
TabSheet1 is from the parent PageControl and TabSheet2 from the child PageControl (the frame's).

 

TinyPortal © 2005-2018