"BR closing" event
Moderators: Susan Smith, admin, Gabriel
"BR closing" event
We have the "BR start" event, sort of, in the form of being able to run a program when BR starts. It would be great if we had a "BR closing" event. For example, I want to log out the user if they abnormally terminate a program.
Fkey 93 indicates this event in BR. It is triggered when they click on the windows X and its also triggered when they use task manager to end the brnative task. You'll want to respond to this fkey value, log the user out and then execute "sy" to close BR.
In ScreenIO, you have the "Exit Event", and you can place the "log out" code in your exit event of your screens, and ScreenIO will make sure to call it whenever the screen is exiting.
Gabriel
In ScreenIO, you have the "Exit Event", and you can place the "log out" code in your exit event of your screens, and ScreenIO will make sure to call it whenever the screen is exiting.
Gabriel
How do I capture this key stroke? I have a client who sometimes clicks the x(close) in the middle of things, rather than exiting via the menu system. I don't capture every keystroke, but do check entries after exiting a field or selecting a menu item.
This is a problem because periodically selecting the x (close) freezes the program. I haven't been able to duplicate the situation on a regular basis on his system, or mine at all. I thought it might disappear with the latest version of BR but that didn't do the trick.
This is a problem because periodically selecting the x (close) freezes the program. I haven't been able to duplicate the situation on a regular basis on his system, or mine at all. I thought it might disappear with the latest version of BR but that didn't do the trick.
You can also put in a "universal trap" in your programs with an on fkey event trap.
For example:
01000 ON FKEY 93 GOTO KEY93
01010 RINPUT FIELDS '10,10,v 2': A$
01020 IF FKEY=99 THEN STOP
01030 GOTO 1010
01040 KEY93: PRINT FIELDS "11,10,c ": "Fkey 93 was pressed"
01050 GOTO 1010
Note that on FKEY was recently changed, it used to be on FNKEY, but that became confusing since only fnuctions are supposed to start with FN
FNGeorge
For example:
01000 ON FKEY 93 GOTO KEY93
01010 RINPUT FIELDS '10,10,v 2': A$
01020 IF FKEY=99 THEN STOP
01030 GOTO 1010
01040 KEY93: PRINT FIELDS "11,10,c ": "Fkey 93 was pressed"
01050 GOTO 1010
Note that on FKEY was recently changed, it used to be on FNKEY, but that became confusing since only fnuctions are supposed to start with FN
FNGeorge
Does this work for you, George?
According to http://brwiki.ads.net/index.php?title=E ... Y_num-expr this will only work for fkeys 1-10. Not 93.
It'd be nice if 99 and 93 would work during processing - then we could actually code a mid process cancel/close option. And then goodbye non-responsive program.
-John
According to http://brwiki.ads.net/index.php?title=E ... Y_num-expr this will only work for fkeys 1-10. Not 93.
It'd be nice if 99 and 93 would work during processing - then we could actually code a mid process cancel/close option. And then goodbye non-responsive program.
-John
further...
00100 pr newpage
01000 ON FKEY 93 GOTO KEY93
01002 ON FKEY 99 GOTO XIT
01022 do
01024 sleep(.1)
01026 pr f '1,1,G 20':x+=1
01028 loop
01040 KEY93: PRINT FIELDS "11,10,c ": "Fkey 93 was pressed"
01050 GOTO 1022
01060 XIT: END
proves that both F93 and F99 will work during processing not being at an input. using these ON FKEY 93 and ON FKEY 99 statements can give your program program wide close and escape behavior! During processing, at Inputs, etc.
I do believe we're on our way to event based processing!!!! YAY!!!
Thanks for the eye-opener, George!!!
-John
00100 pr newpage
01000 ON FKEY 93 GOTO KEY93
01002 ON FKEY 99 GOTO XIT
01022 do
01024 sleep(.1)
01026 pr f '1,1,G 20':x+=1
01028 loop
01040 KEY93: PRINT FIELDS "11,10,c ": "Fkey 93 was pressed"
01050 GOTO 1022
01060 XIT: END
proves that both F93 and F99 will work during processing not being at an input. using these ON FKEY 93 and ON FKEY 99 statements can give your program program wide close and escape behavior! During processing, at Inputs, etc.
I do believe we're on our way to event based processing!!!! YAY!!!
Thanks for the eye-opener, George!!!
-John
What I'm talking about is a global BR_closing event, which always gets triggered before BR quits.
Maybe, adding
on BR_closing run logout.br
into your wbconfig.sys
This way we wouldn't have to add code to each of our programs.
I guess there is no such thing now, but it wouldn't be difficult to implement in future versions of BR.
Maybe, adding
on BR_closing run logout.br
into your wbconfig.sys
This way we wouldn't have to add code to each of our programs.
I guess there is no such thing now, but it wouldn't be difficult to implement in future versions of BR.