Controlling Browser Events

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. 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
Joerg Hamacher
Posts: 48
Joined: Thu Feb 11, 2016 12:01 am

Controlling Browser Events

Post by Joerg Hamacher » Thu Feb 25, 2016 11:52 pm

Hi again,

is it possible to take control over the browser keys and buttons e.g. to react if some tries to close the browser?

Many thanks in advance,
Joerg

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Controlling Browser Events

Post by Stewart Marshall » Fri Feb 26, 2016 8:38 am

Hi Joerg

You can use the VL Short Cut Key (Prim_stpg) to detect key presses. However, all browsers consume some keystrokes for their own purposes, so relying on them is a risky business, and of course they're meaningless on a mobile or tablet.

With regards to stopping the browser navigating away from the page, you need the #sys_web.CloseQuery event. You can see an example of this in the "Messaging in the browser" example (xDemoWebMessaging). Each browser implements the message box differently of course.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply