Kbase P16302: How to dynamically refer to a button name
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/21/2003 |
|
Status: Unverified
GOAL:
How to dynamically reference the NAME of a button?
FIX:
The two buttons defined below perform the following:
Button 1, this looks for ALL buttons on the frame and returns, the Handle, Type & Name of every button.
Button 2, this returns the Handle, Type & Name of the current button.
ON CHOOSE OF BTN1 IN FRAME DEFAULT-FRAME /* Button 1 */
DO:
DEFINE VARIABLE cProc AS CHARACTER NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
DEFINE VARIABLE cName AS CHARACTER NO-UNDO.
hProc = SELF:PARENT.
hProc = hProc:FIRST-CHILD.
DO WHILE VALID-HANDLE(hProc):
cProc = hProc:TYPE.
IF cProc = "BUTTON" THEN DO:
cName = hProc:NAME.
MESSAGE hProc cProc cName.
END. /*IF cProc = Button */
hProc = hProc:NEXT-SIBLING.
END. /* WHILE VALID-HANDLE(hProc) */
END.<
ON CHOOSE OF BTN2 IN FRAME DEFAULT-FRAME /* Button 2 */
DO:
DEFINE VARIABLE cProc AS CHARACTER NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
DEFINE VARIABLE cName AS CHARACTER NO-UNDO.
hProc = SELF:HANDLE.
cProc = hProc:TYPE.
cName = hProc:NAME.
MESSAGE hProc cProc cName.
END.