1. Jan Hoppe
  2. PowerBuilder
  3. Friday, 08 November 2019

In a window we have a tab control with a number of tabpages.

some of these tabpages contains a tab control who has more tabpages etc. 

In one of these tabpages there is a datawindowcontrol named dw_3.

Is there a way to find the dw and select the tabpage so that the user can see dw_3?

 

Attached is a pbl with an example where I want to select the tabpage containing dw_3.

 

Attachments (1)
Who is viewing this page
John Fauss Accepted Answer Pending Moderation
1
Votes
Undo

Hi, Jan -

The following code in the "Find" button will display the (nested) tabpage containing dw_3:

tab_1.SelectTab(2)
tab_1.tabpage_2.tab_3.SelectTab(3)

If you are asking how to programatically examine/search thru tab_1's tabpages and any nested tab controls and tabpages within tab_1's tab pages, you have to recursively examine the array of userobjects named "control[]" which is a property of each tab control and each tabpage user object, using the TypeOf() function on each array element until you find a userobject of type DataWindow! whose name is dw_3.

I suggest you start by examining tab_1's Control[] array of userobjects. Use UpperBound(Tab_1.Control[]) to determine how many tab pages tab_1 contains. Then use the TypeOf() function on each element of this array to obtain the enumerated object type (tab pages have a TypeOf() of UserObject!).

Once you can do this, you then examine the Control[] array of each tabpage, looking for userobjects that have a TypeOf() of Tab! (this will be a nested tab control contained on the tab page) or a TypeOf() of DataWindow!. If/when you find a (nested) tab control, examine the user objects (tabpages) in its Control[] array, and so on until you find the DataWindow named dw_3.

HTH, John

Comment
Added: the TypeOf() of a tabpage() will be "userobject", there's no "tabpage" typeof.
  1. Miguel Leeuwe
  2. Friday, 8 November 2019
Ups ... like John already said :)
  1. Miguel Leeuwe
  2. Friday, 8 November 2019
There are no comments made yet.
  1. Friday, 8 November 2019
  2. PowerBuilder
  3. # 1
Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

Yes, there is. It shouldn't be too difficult knowing that every tab has an array called "control" with all of the objects in it that are inside that tab. For every tabpage there's also the same array called control. So it just a matter of drilling down to find the point of bumping into your dw_3. You have to save the "path" of objects that precede it. Then do a selectTab() for the main tabpage, another SelectTab for the one that holds your dw_3.

If you need help on how to code this, let us know.

Comment
There are no comments made yet.
  1. Friday, 8 November 2019
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.