Consultor Eletrônico



Kbase P53730: 2.1A + Dyn Treeview: How to change folder window to launch w
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/11/2003
Status: Unverified

GOAL:

Dynamics Treeview: How to change the folder window to launch on the fly (when selecting a node)?

GOAL:

How to launch a variable folder Window from a SDO node, depending on the value of a field.

FACT(s) (Environment):

Dynamics 2.1A

FIX:

An enhancement request has been logged to implement this feature into Dynamics.
The following solution has been tested successfully with Dynamics 2.1A.  This solution is the new version of solution p37902 that has become obsolete in 2.1A.
This solution is definitely better than p37902 because it does strongly override amd2/tvcontnr.p (keeps a RUN SUPER)
In a super procedure of your Treeview Container, implement the following code:

/*The idea is to choose the Folder to launch depending on the value of a field
in the node SDO */
DEFINE VARIABLE ghSDO AS HANDLE NO-UNDO.

PROCEDURE createRepositoryObjects :
DEFINE INPUT PARAMETER pcLogicalObjectName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcSDOName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcInstanceAttributes AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER piStructLevel AS INTEGER NO-UNDO.

DEFINE VARIABLE cCode AS CHARACTER NO-UNDO.

IF VALID-HANDLE(ghSDO) THEN DO:
/* you may query getObjectName IN ghSDO, and query one of its property
to run appropriate code */
ASSIGN
cCode = DYNAMIC-FUNCTION("colValues":U IN ghSDO,
INPUT "customer_name,customer_code")
cCode = ENTRY(3, cCode, CHR(1)).

IF INTEGER(cCode) MOD 2 = 0 THEN pcLogicalObjectName = "armcufoldA".
ELSE pcLogicalObjectName = "armcufoldB".
END.

RUN SUPER
(INPUT pcLogicalObjectName,
INPUT pcSDOName,
/*Very important to make pcInstanceAttribute look different for each
FolderWindow when using the new session parameter MaxHiddenContainers
(greater than 0). Otherwize the caching of folderWindow frames will soon
run into problems with wrong containers showing up.*/
INPUT pcInstanceAttributes + INTEGER(cCode) MOD 2 = 0 THEN "|A" ELSE "|B",
INPUT piStructLevel).
END PROCEDURE.


PROCEDURE tvNodeSelected :
DEFINE INPUT PARAMETER pcNodeKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE hTreeBuffer AS HANDLE NO-UNDO.

RUN returnTreeBuffer IN TARGET-PROCEDURE (INPUT pcNodeKey, OUTPUT hTreeBuffer).

ghSDO = IF hTreeBuffer:AVAILABLE
THEN hTreeBuffer:BUFFER-FIELD("sdo_handle":U):BUFFER-VALUE
ELSE ?.

RUN SUPER(pcNodeKey).
END PROCEDURE.