search an object by name or label

bimsimsala

New Member
hello again,
win 2000, v9.1C

thx for your answers in my last thread it helped me a lot.
now heres another problem igot while developing my app.

i create some buttons dynamically. afterwards i have to access som attributes of them. is there a function or a code snippet that allows me to reference the object by its name or label ?
can i loop through all objects that are inside a frame ?

can you help me with that ?

the code:
-------------------------------------------- code --------------------------------------------------------
IF (bPaintButton) THEN DO:
/* create the button */
CREATE BUTTON hButton ASSIGN
HEIGHT-PIXEL = iButtonPixelHeight
WIDTH-PIXEL = iButtonPixelWidth
LABEL = "+"/* string(iCols) */
FRAME = FRAME fMain:HANDLE
SENSITIVE = bButtonSensitive
VISIBLE = TRUE
X = iButtonXStart + (iCols * (iButtonPixelWidth + iButtonPosDelta))
Y = iButtonYStart + (iRows * (iButtonPixelHeight + iButtonPosDelta))
TOOLTIP = "Row: " + string(iRows) + " * Col: " + string(iCols)
NAME = "button_detID_" + strPtDetId.
/* we set the trigger in main block */
END.
-------------------------------------------- code --------------------------------------------------------
 

Mikael Eriksson

New Member
bimsimsala said:
hello again,
win 2000, v9.1C

thx for your answers in my last thread it helped me a lot.
now heres another problem igot while developing my app.

i create some buttons dynamically. afterwards i have to access som attributes of them. is there a function or a code snippet that allows me to reference the object by its name or label ?
can i loop through all objects that are inside a frame ?

can you help me with that ?

the code:
-------------------------------------------- code --------------------------------------------------------
IF (bPaintButton) THEN DO:
/* create the button */
CREATE BUTTON hButton ASSIGN
HEIGHT-PIXEL = iButtonPixelHeight
WIDTH-PIXEL = iButtonPixelWidth
LABEL = "+"/* string(iCols) */
FRAME = FRAME fMain:HANDLE
SENSITIVE = bButtonSensitive
VISIBLE = TRUE
X = iButtonXStart + (iCols * (iButtonPixelWidth + iButtonPosDelta))
Y = iButtonYStart + (iRows * (iButtonPixelHeight + iButtonPosDelta))
TOOLTIP = "Row: " + string(iRows) + " * Col: " + string(iCols)
NAME = "button_detID_" + strPtDetId.
/* we set the trigger in main block */
END.
-------------------------------------------- code --------------------------------------------------------
Hi,
I think you can do something like this.

/*************** CODE *********/
DEFINE VARIABLE frameh AS HANDLE NO-UNDO.
DEFINE VARIABLE temph AS HANDLE NO-UNDO.

frameh = FRAME fMain:HANDLE.
temph = frameh:FIRST-CHILD().
DO WHILE VALID-HANDLE(temph):
/* do whatever you whant to do with your current handle */
/* Ex. temph:NAME temph:TYPE temph:LABEL */
temph = temph:NEXT-SIBLING.
END.

/*************** END CODE *********/

This loop only take the siblings to first child in the frame, if you have plenty of frames in fMain frame you have to do this to all the frames to reach all widgets in the fMain frame.

I hope this will help you........

/Mikael
 
Top