F5 Handling, especially in RAMP applications

This forum allows developers to post programming tips and coding techniques that may be useful to other Visual LANSA developers. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MarkD
Posts: 626
Joined: Wed Dec 02, 2015 9:56 am

F5 Handling, especially in RAMP applications

Post by MarkD » Wed Jun 06, 2018 9:44 am

Using F5 in a single page application like VLF-ONE will by default cause the web page to be refreshed.
This blows away the current VLF-ONE application, causing it to restart.

In non-RAMP applications this is not that much of a problem because users are not inclined to use F5, other than by accident.

However, in RAMP applications it may be more of a problem because F5 may be widely used in 5250 screen interactions. If the focus is not on the 5250 screen when the user presses F5, the keystroke gets directed out to the outer container, which can blow away the VLF-ONE application.

The solution seems to be to trap and ignore the F5 key, which can be done like this.

In the avMAINWindowReady method of your framework’s IIP enroll F5 as a shortcut:

Code: Select all

#USYSTEM.MainVLFPanel.EnrollShortCut Shortcut(F5) Logicaloperation(IGNORE)
Add a #USYSTEM.RequestShortCut event handler ....

Code: Select all

Evtroutine Handling(#USYSTEM.RequestShortCut) Logicaloperation(#LogicalOperation)
Case (#LogicalOperation)
When (= IGNORE)
* Do nothing
When (= XXXXXXXXX)
* Do something 
If you look at the shipped DF_OSYSTM you can see other short cut handling examples, like how to turn tracing off and on.

There may be other browser keys that you want to ignore this way, although it appears not all are trappable.

Post Reply