Consultor Eletrônico



Kbase P6153: Dynamics: How to get the handle of a particular dynamic combo?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   31/05/2005
Status: Verified

GOAL:

How to get the handle of a particular dynamic combo?

GOAL:

How do I retrieve the handle for a data bound dynamic combo box placed on a SmartDataViewer?

FACT(s) (Environment):

Dynamics

FIX:

In order to accomplish this, insert the following statements into the Viewer's Super Procedure code:

1) In the definition Block:

DEFINE VARIABLE hMyDynCombo AS HANDLE NO-UNDO.

2) In a procedure override of initializeObject, after RUN SUPER:


DEFINE VARIABLE chFields AS CHARACTER NO-UNDO.
DEFINE VARIABLE iFieldCnt AS INTEGER NO-UNDO.
DEFINE VARIABLE hField AS HANDLE NO-UNDO.
DEFINE VARIABLE c AS CHARACTER NO-UNDO.

/* Get handles of displayed fields in a dynamic viewer */
chFields = DYNAMIC-FUNCTION("getAllFieldHandles" IN TARGET-PROCEDURE).

/* find the field to assign the popup menu */
DO iFieldCnt = 1 TO NUM-ENTRIES(chFields):
hField = WIDGET-HANDLE(ENTRY(iFieldCnt, chFields)).

IF hField:TYPE <> "PROCEDURE" THEN NEXT.

c = DYNAMIC-FUNCTION("getObjectName" IN hField) NO-ERROR.
IF ERROR-STATUS:ERROR OR c <> "DynCombo" THEN NEXT.

c = DYNAMIC-FUNCTION("getKeyField" IN hField) NO-ERROR.
IF ERROR-STATUS:ERROR OR c <> "<myTable>.<myField>" THEN NEXT.

/* So now we are pretty sure that the handle is for the right Dyn Combo*/
hMyDynCombo = hField.
END.