Consultor Eletrônico



Kbase P103950: ADM1:  How to leave an updatable SmartBrowse when the user presses the TAB key while at the last cel
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/6/2005
Status: Unverified

GOAL:

ADM1: How to leave an updatable SmartBrowse when the user presses the TAB key while at the last cell of the last ROW of the browse?

FIX:

The following steps allow the user to leave an updatable SmartBrowse when the user presses the TAB key while at the last cell of the last ROW of the browse:
1. Define a local-open-query override to open the query with the PRSELECT option to allow the NUM-RESULTS function to return the total number of records returned by the query:
/*----------------------------------------------------------------------
Purpose: Override standard ADM method to use the PRESELECT option that allows the NUM-RESULTS function to return the true total number of records in the result set.
Notes: Note that the default statement that opens the query has been removed.
------------------------------------------------------------------------*/
OPEN QUERY br_table PRESELECT EACH customer WHERE Cust-num < 11.
END PROCEDURE.
2. Define a LEAVE or a TAB event trigger on the last column in the browse that will (1) Test if we are at the last row of the query result set and (2) Get the handle of the parent window and (3) Run a procedure in the parent window that will Apply entry to the first widget in the parent window's default frame:
DO:
IF NUM-RESULTS("br_table") = CURRENT-RESULT-ROW("br_table") THEN
DO:
DEFINE VARIABLE hParent AS HANDLE NO-UNDO.
DEFINE VARIABLE vcTemp AS CHARACTER NO-UNDO.
RUN get-link-handle IN adm-broker-hdl(THIS-PROCEDURE:HANDLE, 'CONTAINER-SOURCE':U, OUTPUT vcTemp ).
hParent = WIDGET-HANDLE( vcTemp ).
RUN ApplyEntryToParentWindow IN hParent.
RETURN NO-APPLY.
END.
END.
3. On the main window, define a procedure ApplyEntryToParentWindow to locate the first widget on its default frame and apply entry to it:
/*----------------------------------------------------------------------
Purpose: Get the handle of the first widget of the default frame and apply entry to it.
Parameters: <none>
Notes:
------------------------------------------------------------------------*/
DEFINE VARIABLE h AS HANDLE NO-UNDO.
ASSIGN
h = FRAME {&FRAME-NAME}:FIRST-CHILD
h = h:FIRST-CHILD.
APPLY 'ENTRY' TO h.
END PROCEDURE.