Consultor Eletrônico



Kbase P105718: How to close an ADM2 smartSelect browse when an update is cancelled.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   27/06/2005
Status: Unverified

GOAL:

How to close an ADM2 smartSelect browse when an update is cancelled.

GOAL:

If a smartSelect browse is open for a record update and the update is cancelled, the smartSelect browse remains and can update the screen-value of its smartSelect. How can this be prevented?

FIX:


To resolve this problem the smartSelect browse should be closed when the record update is cancelled from the toolbar. In order to achieve this destroyObject can be run in the smartSelect browse container in the following way:
1. From the smartDataViewer 'InitializeObject' override get the handle to the smartSelect SDO.

2. In the smartDataViewer 'cancelRecord' override get the handle of the dataTargets for the SDO identified in 1 above. One of these could be the smartSelect browse, if it is open. When you have the handle of the browse, get its container object and run 'cancelRecord' in this object to close the browse.
Subsequently, whenever the cancel update button is selected from the toolbar, if the smartSelect Browse is open, it will be closed. Example code is below:

/* SmartDataViewer - InitializeObject override */
RUN SUPER.
{get containerTarget cTargets}.
/* get handle to smartSelect SDO */
DO i = 1 TO NUM-ENTRIES(cTargets):
h_obj = WIDGET-HANDLE(ENTRY(i,cTargets)).
IF DYNAMIC-FUNCTION('getObjectType':U IN h_obj) = 'smartDataObject' THEN
h_SDO = h_obj.
END.
/* End - InitializeObject */

/* SmartDataViewer - cancelRecord override */
RUN SUPER.

IF h_SDO NE ? THEN
DO:
/* get handle to smartSelect browse */
{get dataTarget cTargets h_SDO}.
DO i = 1 TO NUM-ENTRIES(cTargets):
h_obj = WIDGET-HANDLE(entry(i,cTargets)).
IF DYNAMIC-FUNCTION('getObjectType':U IN h_obj) = "smartDataBrowser" THEN
DO:
/* get handle to browse container */
{get containerSource h_Window h_obj}.
IF VALID-HANDLE(h_window) THEN
RUN destroyObject IN h_window.
END.

END.
END.
/* End - cancelRecord */