1. Jan Hoppe
  2. PowerBuilder
  3. Friday, 8 November 2019 13:48 PM UTC

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)
Jan Hoppe Accepted Answer Pending Moderation
  1. Monday, 18 November 2019 14:34 PM UTC
  2. PowerBuilder
  3. # 1

Thanks for the reply, my problem was that I did not know that at tabpage is a userobject and that this userobject , in the case of nested tabs, would contain one or more tabs.

Having realised that I am able to solve the problem.

  

Comment
  1. Michael Kramer
  2. Monday, 18 November 2019 15:24 PM UTC
Hey Jan, wish you luck!

If you have reference to the DataWindow control (EX: In idw-array if it is the app I know) - then you can traverse outwards through tab pages, tab controls, custom visuals, and windows using GetParent( ) function in a loop. This builds the complete nested hierarchy that needs to select the tab page and set focus.

Such loop takes some type checking and type casting but the code itself is pretty straightforward.

Again if it is the app I know you may be able to search for .GetParent and find a similar loop I may have built a decade ago. It may not do all you need but it will give you the structure as a starting point.

HTH /Michael

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 8 November 2019 16:42 PM UTC
  2. PowerBuilder
  3. # 2

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
  1. Miguel Leeuwe
  2. Friday, 8 November 2019 16:48 PM UTC
Added: the TypeOf() of a tabpage() will be "userobject", there's no "tabpage" typeof.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 8 November 2019 16:48 PM UTC
Ups ... like John already said :)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 8 November 2019 16:38 PM UTC
  2. PowerBuilder
  3. # 3

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.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.