Consultor Eletrônico



Kbase P48678: How to know the available attributes and methods for a widget/object
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/05/2005
Status: Unverified

GOAL:

How to know the available attributes, methods and events for a widget/object?

FIX:

Use the LIST-QUERY-ATTRS, LIST-SET-ATTRS and LIST-EVENTS 4GL Functions. For example, the following code retrieves the Read/Write, the Read/Only and the Event lists for the FRAME widget:
DEFINE FRAME fName.
DEFINE VARIABLE hWidgetHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE AllTheWidgetAttributes AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTheReadOnlyAttributes AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTheReadWriteAttributes AS CHARACTER NO-UNDO.
DEFINE VARIABLE cWidgetEventList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentAttribute AS CHARACTER NO-UNDO.
ASSIGN
hWidgetHandle = FRAME fName:HANDLE
AllTheWidgetAttributes = LIST-QUERY-ATTRS(hWidgetHandle)
cTheReadWriteAttributes = LIST-SET-ATTRS(hWidgetHandle)
cWidgetEventList = LIST-EVENTS(hWidgetHandle).
DO i = 1 TO NUM-ENTRIES(AllTheWidgetAttributes):
cCurrentAttribute = ENTRY(i, AllTheWidgetAttributes, ",").
IF LOOKUP(cCurrentAttribute , cTheReadWriteAttributes, ",") = 0 THEN
cTheReadOnlyAttributes = cTheReadOnlyAttributes + "," + cCurrentAttribute.
END.
cTheReadOnlyAttributes = LEFT-TRIM(cTheReadOnlyAttributes, ",").
MESSAGE
"The FRAME widget has the following attributes: " "~n" SKIP AllTheWidgetAttributes
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE
"The FRAME widget has the following Read/Write attributes: " "~n" SKIP cTheReadWriteAttributes
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE
"The FRAME widget has the following Read/Only attributes: " "~n" SKIP cTheReadOnlyAttributes
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE
"The FRAME widget has the following EVENT list: " "~n" SKIP cWidgetEventList
VIEW-AS ALERT-BOX INFO BUTTONS OK.