Updateable browse and switching windows

KarinV

New Member
I am using an updateable browse. When I use another application (to check some data or something like that) and I return to the browse, the row-leave trigger fires, writing a record in the database when I don't want it.
I would like to be able to switch windows without my browse being affected.
Does anyone know how to do that?
 
Try setting the NO-ASSIGN checkbox on the browser.



KarinV said:
I am using an updateable browse. When I use another application (to check some data or something like that) and I return to the browse, the row-leave trigger fires, writing a record in the database when I don't want it.
I would like to be able to switch windows without my browse being affected.
Does anyone know how to do that?
 
It already is NO-ASSIGN. The problem is that there is one procedure (for all updateable browsers). The row-leave trigger validates and stores the data.
Nothing wrong with that, except that the row-leave trigger is fired at unexpected moments. Is there a way to tell if the row-leave is the result of an action in the browser or a result from simply leaving and returning to the window?
 
Is it a solution to define a local trigger on the browser? (overloading)



KarinV said:
It already is NO-ASSIGN. The problem is that there is one procedure (for all updateable browsers). The row-leave trigger validates and stores the data.
Nothing wrong with that, except that the row-leave trigger is fired at unexpected moments. Is there a way to tell if the row-leave is the result of an action in the browser or a result from simply leaving and returning to the window?
 
Try the following code in your ROW-LEAVE:


DEFINE VARIABLE lh_wig AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE lh_frm AS WIDGET-HANDLE NO-UNDO.

ASSIGN
lh_wig = LAST-EVENT:WIDGET-ENTER
.

IF BROWSE {&BROWSE-NAME}:CURRENT-COLUMN = lh_wig THEN
DO:

/* Your row leave code etc. */

END.




KarinV said:
It already is NO-ASSIGN. The problem is that there is one procedure (for all updateable browsers). The row-leave trigger validates and stores the data.
Nothing wrong with that, except that the row-leave trigger is fired at unexpected moments. Is there a way to tell if the row-leave is the result of an action in the browser or a result from simply leaving and returning to the window?
 
If you have more than one column enabled in you browse you will need to use the following instead:

FUNCTION is_browse_column RETURNS LOGICAL
( lh_browse AS WIDGET-HANDLE,
lh_column AS WIDGET-HANDLE ) :

DEFINE VARIABLE ll_ret AS LOGICAL NO-UNDO INITIAL FALSE.

DEFINE VARIABLE li_i AS INTEGER NO-UNDO.
DEFINE VARIABLE lh_w AS WIDGET NO-UNDO.
DO li_i = 1 TO lh_browse:NUM-COLUMNS:
ASSIGN
lh_w = lh_browse:GET-BROWSE-COLUMN( li_i )
.
IF lh_w = lh_column THEN
DO:

ASSIGN
ll_ret = TRUE.
LEAVE.
END.
END.
RETURN ll_ret. /* Function return value. */
END FUNCTION.


DEFINE VARIABLE lh_wig AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE lh_frm AS WIDGET-HANDLE NO-UNDO.
ASSIGN
lh_wig = LAST-EVENT:WIDGET-ENTER
.

IF is_browse_column( BROWSE {&BROWSE-NAME}:HANDLE, lh_wig ) THEN
DO:
MESSAGE "Browser".
END.




KarinV said:
It already is NO-ASSIGN. The problem is that there is one procedure (for all updateable browsers). The row-leave trigger validates and stores the data.
Nothing wrong with that, except that the row-leave trigger is fired at unexpected moments. Is there a way to tell if the row-leave is the result of an action in the browser or a result from simply leaving and returning to the window?
 
Thanks. There seems to be another problem. First the LEAVE-trigger is fired.
But you got me on the right track.

A possible solution is this:

In every LEAVE-trigger:

IF NOT (VALID-HANDLE(LAST-EVENT:WIDGET-LEAVE) AND
VALID-HANDLE(LAST-EVENT:WIDGET-ENTER))
OR SELF <> LAST-EVENT:WIDGET-LEAVE
THEN
RETURN NO-APPLY.

It is not very nice, but it works.

The problem is that whenever you mouseclick in your browseframe (not one of the enabled fields I mean), the widget-enter handle is not-valid. Same for the widget-leave.


Sroach said:
If you have more than one column enabled in you browse you will need to use the following instead:

FUNCTION is_browse_column RETURNS LOGICAL
( lh_browse AS WIDGET-HANDLE,
lh_column AS WIDGET-HANDLE ) :

DEFINE VARIABLE ll_ret AS LOGICAL NO-UNDO INITIAL FALSE.

DEFINE VARIABLE li_i AS INTEGER NO-UNDO.
DEFINE VARIABLE lh_w AS WIDGET NO-UNDO.
DO li_i = 1 TO lh_browse:NUM-COLUMNS:
ASSIGN
lh_w = lh_browse:GET-BROWSE-COLUMN( li_i )
.
IF lh_w = lh_column THEN
DO:

ASSIGN
ll_ret = TRUE.
LEAVE.
END.
END.
RETURN ll_ret. /* Function return value. */
END FUNCTION.


DEFINE VARIABLE lh_wig AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE lh_frm AS WIDGET-HANDLE NO-UNDO.
ASSIGN
lh_wig = LAST-EVENT:WIDGET-ENTER
.

IF is_browse_column( BROWSE {&BROWSE-NAME}:HANDLE, lh_wig ) THEN
DO:
MESSAGE "Browser".
END.
 
Back
Top