Consultor Eletrônico



Kbase P120823: How to get the current page label in Dynamics?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/30/2006
Status: Unverified

GOAL:

How to get the current page label in Dynamics?

GOAL:

How to get the page label of a dynamic folder object afspfoldrw.w.

FACT(s) (Environment):

Dynamics

FIX:

The easiest way to do this is to get the labels of the folder object and the current page, then use the current page to get the correct label. Since the folder labels are stored in a delimited string, this is relatively easy to do.
The example code below is trigger code from a button on a static SmartDataViewer that is placed on a dynamic folder object. Initially it gets the handle of the parent container, then using this handle gets the handle of the folder object. Then the appropriate functions can be called in the respective handles to get the current page and label.
DEFINE VARIABLE cSource AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTargets AS CHARACTER NO-UNDO.
DEFINE VARIABLE cType AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE h_object AS HANDLE NO-UNDO.
DEFINE VARIABLE h_parent AS HANDLE NO-UNDO.
DEFINE VARIABLE h_folder AS HANDLE NO-UNDO.
DEFINE VARIABLE cLabels AS CHARACTER NO-UNDO.
DEFINE VARIABLE cLabel AS CHARACTER NO-UNDO.
DEFINE VARIABLE cPage AS CHARACTER NO-UNDO.
DEFINE VARIABLE currentLabel AS CHARACTER NO-UNDO.

/* Get handle to parent window */
{get containersource cSource}.
h_parent = WIDGET-HANDLE(cSource).

/* Get target objects, one of which is a smartFolder */
{get containerTarget cTargets h_parent}.
DO i = 1 TO NUM-ENTRIES(cTargets):
h_object = WIDGET-HANDLE(ENTRY(i,cTargets)).
{get ObjectType cType h_object}.
IF cType = "smartFolder" THEN
DO:
h_folder = h_object.
LEAVE.
END.
END.

IF VALID-HANDLE(h_folder) THEN
DO:
cLabels = DYNAMIC-FUNCTION('getFolderLabels':u IN h_folder).
clabel = DYNAMIC-FUNCTION('getLabel':u IN h_folder).
cPage = DYNAMIC-FUNCTION('getCurrentPage':U IN h_parent).
currentLabel = ENTRY(INT(cPage),cLabels,"|").
MESSAGE "Labels : " cLabels SKIP
"Page : " cPage SKIP
"Current Page Label : " currentLabel
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.