Kbase P112655: 4GL/ABL: How to make a multiple select browse fire the VALUE-CHANGED event trigger on the CURSOR-DOW
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/12/2008 |
|
Status: Verified
GOAL:
4GL/ABL: How to make a multiple select browse fire the VALUE-CHANGED event trigger on the CURSOR-DOWN keyboard event?
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
FIX:
The following code implements a CURSOR-DOWN event trigger that will fire a multiple select browse VALUE-CHANGED event trigger:
ON CURSOR-DOWN OF BROWSE-1 IN FRAME DEFAULT-FRAME
DO:
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE r AS ROWID NO-UNDO.
DEFINE VARIABLE iFinish-Row AS INTEGER NO-UNDO.
/* Get a rowid list of all the currently selected rows */
DO i = 1 TO BROWSE BROWSE-1:NUM-SELECTED-ROWS:
BROWSE BROWSE-1:FETCH-SELECTED-ROW(i).
c = c + "," + STRING(ROWID(Customer)).
END.
c = LEFT-TRIM(c, ",").
/* Add the rowid of the new row to the list or rowid's */
BROWSE BROWSE-1:SELECT-FOCUSED-ROW( ).
BROWSE BROWSE-1:SELECT-NEXT-ROW( ).
iFinish-Row = BROWSE-1:FOCUSED-ROW.
c = c + "," + STRING(ROWID(Customer)).
/* deselect all the selected rows */
BROWSE BROWSE-1:DESELECT-ROWS ( ).
/* ReSelect previously selected rows and the new selected row*/
DO i = 1 TO NUM-ENTRIES(c):
r = TO-ROWID(ENTRY (i,c,",")).
REPOSITION {&BROWSE-NAME} TO ROWID r.
BROWSE {&BROWSE-NAME}:SELECT-FOCUSED-ROW() NO-ERROR.
BROWSE BROWSE-1:SET-REPOSITIONED-ROW( iFinish-Row , "ALWAYS" ).
END.
/* Apply the VALUE-CHANGED trigger for the row we landed on when we used the CURSOR-DOWN key */
APPLY 'VALUE-CHANGED' TO BROWSE BROWSE-1.
END.