How can determine the handles of variables in a list?

mrobles

Member
Hi.

I have a list {&list-1} with some variables. All of them are in a frame.
How can i determinate the handle of each variable?
V9.

Thanks a Lot
 

RealHeavyDude

Well-Known Member
I am not aware of any way that would allow you to directly access the handles to widgets which are on some list on a pre-processor variable.

What should be possible ...

You can store the contents of this pre-processor variable on a character variable.

ASSIGN cMyCharVar = "{&LIST-1}".

Then you could do a widget walk on the frame do get the handles to all objects which are on the frame. You need to be aware, that the first child you will get will be something like a FIELD-GROUP of which I never found out for what it's worth.

Something like this should do (used Outlook as editor therefore it's not syntax cheked):
DEFINE VARIABLE hWidget AS HANDLE NO-UNDO.

ASSIGN hWidget = FRAME {&FRAME-NAME}:HANDLE
hWidget = hWidget:FIRST-CHILD
hWidget = hWidget:FIRST-CHILD.

DO WHILE VALID-HANDLE ( hWidget ):

MESSAGE hWidget:NAME SKIP hWidget:TYPE
VIEW-AS ALERT-BOX INFO BUTTONS OK.

ASSIGN hWidget = hWidget:NEXT-SIBLING.
END.
Now you just need to lookup the contents of your character variable whether you get a match with the NAME attribute of one of the widgets ...


HTH, RealHeavyDude.
 
walk the widget tree.
In UR frame work through the objects realized. When the attribute you require is realized - it`s UR object eg.name attribute or type. When you are confident it is the required object the attribute you are then interested in is object:handle. Store this value as appropriate, you have determined the handle
 

mrobles

Member
Thanks a lot RHD

In the program A.W i use this
{ADLIMPIA.I "{&TEXTOS}"}.

and ADLIMPIA.I now has this code:

DEF VAR t_campos AS CHAR NO-UNDO.
t_campos = "{1}".
t_campos = REPLACE(t_campos, ' ', ',').
t_campos = REPLACE(t_campos,' ',','). /* with this i can use lookup */
DEFINE VARIABLE hWidget AS HANDLE NO-UNDO.
ASSIGN hWidget = FRAME default-frame:HANDLE.
hWidget = hWidget:FIRST-CHILD.
hWidget = hWidget:FIRST-CHILD.
DO WHILE VALID-HANDLE ( hWidget ):
IF LOOKUP(hWidget:NAME,t_campos) > 0 THEN hWidget:SCREEN-VALUE = ''.
ASSIGN hWidget = hWidget:NEXT-SIBLING.
END.
ASSIGN {1}.


All this code is used for clean variables used for filters and due I have many w programs with filters, then this code is a general solution.
It works ok.
Thanks
 
Top