Consultor Eletrônico



Kbase 21915: Accessing SCREEN-VALUEs of a SmartViewer from a Smart Panel
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/26/2002
SUMMARY:

This Solution demonstrates a way to access the SCREEN-VALUE of a SmartDataViewer (SDV) from a SmartPanel. The example code below is placed in one of the SmartPanel's button triggers.

Although this example specifically uses the Smart Update Save Panel (pupdsav.w), it can easily be generalized to access the SCREEN-VALUE of any SmartDataViewer field from anywhere in the application, given the SDV's handle and the field's name.

EXPLANATION:

The example code completes these key steps:

1) Gets the field of interest from within the SmartPanel.
2) Gets the handle of the viewer.
3) Gets the list of the SmartViewer field names.
4) Gets the position of the field's name in the list.
5) Extracts the handle of the field we want.
6) Messages the field's SCREEN-VALUE.

SOLUTION:

DEFINE VARIABLE hViewer AS HANDLE NO-UNDO.
DEFINE VARIABLE cAllFieldsHandles AS CHARACTER NO-UNDO.
DEFINE VARIABLE hMyFieldHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE cMyFieldValue AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDisplayedFields AS CHARACTER NO-UNDO.
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.

ASSIGN
cMyFieldValue = "Country"
hViewer = DYNAMIC-FUNCTION('getTableIOTarget':U)
cDisplayedFields = DYNAMIC-FUNCTION('getDisplayedFields':U IN
hViewer)
iCounter = LOOKUP ( cMyFieldValue, cDisplayedFields ) cAllFieldsHandles = DYNAMIC-FUNCTION('getFieldHandles':U IN
hViewer)
hMyFieldHandle = WIDGET-HANDLE(ENTRY(iCounter,
cAllFieldsHandles)).

MESSAGE hMyFieldHandle:SCREEN-VALUE
VIEW-AS ALERT-BOX INFO BUTTONS OK.


References to Written Documentation:

ADM2 Source Code located in DLC\SRC\ADM2

Progress Knowledge Base Solution 21879, "How To Get and Use the SCREEN-VALUE of a SmartSelect"