views:

129

answers:

1

I'm currently developing a PowerBuilder application and noticed that each window features a 'ParentWindow' function. However, there doesn't seem to be a 'ChildWindows' or anything like that.

Unfortunately, the Documentation at sybase.com just says that these base classes are not documented. Maybe somebody figured it out anyway, using some sort of reflection?

What I would like to do (this is the reason why I'm interested in the API of the generic baseclasses like PowerObject or WindowObject) is to recursively iterate over all GUI elements (windows, tables, buttons, check boxes, you name it) using PowerScript in PowerBuilder 11.0. Does anybody know how to do this (whether this is possible at all)?

+4  A: 

For the API (functions, properties, etc...) of any system object, including PowerObject or WindowObject:

  • Open the Object Browser (icon on the PowerBar toolbar, or under the Tools menu item in later versions of PB)
  • Go to the System tab
  • (not essential, but for bonus points) Right click on the left pane and select Show Hierarchy from the menu
  • Select the object in question on the left pane
  • Double click the Properties, Events or Functions headers in the right pane to expand the list.

As for iterating over all GUI elements, the easiest way is to maintain a list of window handles in the Open and Close events of your common ancestor to all your windows (you do have a common ancestor to all your windows, don't you?) and go through the list, recursing through the Control[] arrays (note that UserObjects, Tabs and TabPages have Control[] arrays as well as Windows). Unless you're going to mess around with Windows APIs to get all the window handles belonging to a process, there's no easy way to get this list without maintaining this list yourself.

Good luck,

Terry.

Terry