Get widet handle from procedure

ninjaimp

New Member
Hi
Im trying to get the handle of a widget but cant seem to get any further than a window.
running the below will loop through all the procedures running but how would i get a handle to one of these so that i can chaneg the WINDOW-STATE

Code:
def var v-hand as handle no-undo.
def var v-hand2 as handle no-undo.
v-hand = session:first-procedure.
   do while valid-handle(v-hand):
        v-hand2 = v-hand:next-sibling.
        MESSAGE v-hand2:TYPE VIEW-AS ALERT-BOX.
        v-hand = v-hand2.
      end.
any help is appreciated.
 
You have to have it as a procedure, and then test th ewidget type. If it's a window, a frame, etc then call self using first child.

This snippet will help.

Code:
CASE ipWidgetHandle:TYPE:
      WHEN "WINDOW":U OR 
      WHEN "FRAME":U OR 
      WHEN "DIALOG-BOX":U OR 
      WHEN "FIELD-GROUP":U THEN
      DO:    
          RUN getWidgetHandles(ipWidgetHandle:FIRST-CHILD). 
      END.
END CASE.
 
thanks for the response but im slightly confused still.

In my code all it ever returns is the type 'Procedure' - how do i look further to get to it child types window, frame etc.
 
You need to replace FIRST-PROCEDURE with FIRST-OBJECT. But you need to be aware that this is a tree in which the first level are of type WINDOW and NEXT-SIBLING will only get you all windows. Therefore you need to add an additional level below a widget of type WINDOW.

Heavy Regards, RealHeavyDude.
 
Thanks, but changing this

v-hand = session:FIRST-OBJECT.

gives the error:

Incompatible data types in expression or assignment.

and it is declared as:

def var v-hand as handle no-undo.
 
Back
Top