Consultor Eletrônico



Kbase 21605: ADM2 -- How To Hide Smart Objects and Redisplay Them.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/12/2004
SUMMARY:

This Knowledge Base Solution applies to Progress Version 9 and higher.

Sometimes it might be easier for a developer to hide smart objects and display other objects instead of using smart folders or other paging methods. This is an example of how to hide a SmartDataViewer.

SOLUTION:

1) Create a SmartDataObject (SDO) using the sports database and the
customer table.

2) Create a SmartDataViewer (SDV) and place some fields from the SDO
(for example, Name and City)

3) Create a SmartWindow and place the SDO, and SDV in it.

4) Create two buttons, one to Display the Viewer and another to Hide
the Viewer, and place both on the SmartWindow.

5) The trigger code for the Display Viewer button should be as
follows:

DO:
DYNAMIC-FUNCTION ('setUserProperty' IN h_vcustprop,
INPUT 'HideOnInit',
INPUT 'no').
DYNAMIC-FUNCTION ('setUserProperty' IN h_vcustprop,
INPUT 'DisableOnInit',
INPUT 'no').

RUN ViewObject IN h_vcustprop.
RUN EnableObject IN h_vcustprop.

END.

6) The trigger code for the Hide Viewer button should be as follows:

DO:
DYNAMIC-FUNCTION ('setUserProperty' IN h_vcustprop,
INPUT 'HideOnInit',
INPUT 'yes').
DYNAMIC-FUNCTION ('setUserProperty' IN h_vcustprop,
INPUT 'DisableOnInit',
INPUT 'yes').

RUN HideObject IN h_vcustprop.

/* RUN DisableObject IN h_vcustprop.
This will cause the objects to be disabled the first time
they are displayed when you press the Display Viewer button.*/

END.

NOTE: h_vcustprop is the handle of the SmartDataViewer in the SmartWindow.

You can also place a SmartToolbar on the SmartWindow and link it to the SDV and SDO. When you hide and display the SDV, the record in the SDV will be the last one you selected. And if you have navigation enabled on the toolbar, you can select a different record even when the object is hidden.