Is there a way to travers all Windows in an Application? - Forum - OpenEdge Development - Progress Community

Is there a way to travers all Windows in an Application?

 Forum

Is there a way to travers all Windows in an Application?

This question is answered

11.7

I would like to do something like this:

def var hObj as handle no-undo.

def var hChild as handle no-undo.

hObj = session:first-procedure.

do while valid-handle(hObj):

  hChild = hObj:first-child.

  do while valid-handle(hChild):

   /************** trying to find Windows **********/

    hChild = hChild:next-sibling.

  end. 

   hObj = hObj:next-sibling.

end.

Since I can't find any window, I am doing something wrong :-) I would like to i.e. Count all Windows or manipulate an attribute within the Window-handle.

Anyone done this?

//Geir Otto

Verified Answer
  • The chain of windows starts at SESSION:FIRST-CHILD. You can find all of the windows by traversing this chain.

All Replies
  • The chain of windows starts at SESSION:FIRST-CHILD. You can find all of the windows by traversing this chain.

  • Probably something like this (disclaimer: I've not tested this).

    Perhaps you'll need to modify it to run recursively if you want to get every window. 

    define variable hWindow as handle NO-UNDO.
    
    assign hWindow = Session:handle:first-child.
    
    do while hWindow <> ?:
    
        if lookup(hWindow:type, "WINDOW,DIALOG-BOX") <> 0 then 
        do:
            /* do whatever you need to do */
        end.
        
    
        assign hWindow = hWindow:next-sibling.
    
    end.
  • aaah, thanks :-)