Consultor Eletrônico



Kbase P10031: How to make values defined in the main smart window object available throughout the session.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/10/2008
Status: Verified

GOAL:

How to access values defined in the main smart window from anywhere in the application without having the handle of that window.

GOAL:

How to set a property in one SmartWindow and retrieve it in another SmartWindow.

FACT(s) (Environment):

Windows
OpenEdge 10.x

FIX:

1. Store the list of values you need in user defined property using the SetUserProperty function by executing code similar to the following in the main smart window object:

DYNAMIC-FUNCTION('setUserProperty':U IN this-PROCEDURE,
INPUT "cPropertyName" /* CHARACTER */,
INPUT "cProperty Values" /* CHARACTER */).

2. To retrieve the values from anywhere in the session (i.e. a subordinate child window) execute code similar to:

DEFINE VARIABLE cProc AS CHARACTER NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
DEFINE VARIABLE cPropValues AS CHARACTER NO-UNDO.

hProc = SESSION:FIRST-CHILD.
DO WHILE VALID-HANDLE(hProc):
cProc = hProc:TYPE.

IF cProc = "WINDOW" THEN
DO:
cPropValues = DYNAMIC-FUNCTION('getUserProperty':U IN hProc:INSTANTIATING-PROCEDURE,
INPUT "cPropertyName").
IF cPropValues NE "" AND cPropValues NE ? THEN
DO:
MESSAGE cPropValues
VIEW-AS ALERT-BOX INFO BUTTONS OK.
LEAVE.
END.
END.
hProc = hProc:NEXT-SIBLING.
END.

This fix will not work in Progress 9.x since the INSTANTIATING-PROCEDURE attribute does not exist prior to OpenEdge 10.x.