Consultor Eletrônico



Kbase P101913: SDV in Dynamics Treeview: cannot obtain parent datasource during init./display
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/03/2005
Status: Unverified

FACT(s) (Environment):

Dynamics 2.1B

SYMPTOM(s):

data link not set yet between two SDO nodes

Viewer used in a Dynamics treeview

Trying to obtain the handle of a parent SDO during the initialization of a viewer

CHANGE:

upgraded from 2.1A02

CAUSE:

Known regression in 2.1A03 and 2.1B reported to development. There is maybe some general advice that one ideally should prepare SDOs and their viewers to be able to stand on their own and manage without their parents, but the treeview should continue to keep parents available and in synch also in 2.1B. (Links are activated/removed temporarily at several occasions so limitations do apply)

FIX:


An interesting work around is to use the getRunningSDOs API in adm2/tvcontnr.p, which provides interesting details. Just implement the following code in:

1) definition block of the viewer custom super procedure:
{src/adm2/treettdef.i}
2) initializeObject of the viewer custom super procedure:
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE hDataSource2 AS HANDLE NO-UNDO.
DEFINE VARIABLE hContainerSource AS HANDLE NO-UNDO.
RUN SUPER.
/* data source o the viewer, the one we have problems to get the parent */
{get dataSource hDataSource}.
/* get Handle of smartFrame (folder window that contains the viewer)*/
{get ContainerSource hContainerSource}.
/* get handle of the TvContainer smartWindow */
{get ContainerSource hContainerSource hContainerSource}.
RUN getRunningSDOs IN hContainerSource (OUTPUT TABLE ttRunningSDOs).
/* Dump the temp-table to see what it contains:
OUTPUT TO testTv.txt.
FOR EACH ttRunningSDOs:
DISPLAY
INT(hTargetProcedure)
cSDOName FORMAT "X(20)"
INT(hSDOHandle)
cServerMode
INT(hParentSDO)
iStrucLevel
dNodeObj
WITH WIDTH 320.
END.
OUTPUT CLOSE. */
FIND FIRST ttRunningSDOs WHERE hSDOHandle = hDataSource.
MESSAGE "Here is the Parent SDO:" SKIP
ttRunningSDOs.hParentSDO SKIP
DYNAMIC-FUNCTION('getObjectName' IN ttRunningSDOs.hParentSDO)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
EMPTY TEMP-TABLE ttRunningSDOs.

END PROCEDURE.