View Full Version : Shortcut Keys
johncorro
10-06-2004, 09:36 PM
Is there any way to map shortcut keys to a given action/button/etc? For instance, I'm trying to build an application where certain portions are intensive on the data entry side. I'm trying to enable something akin to "Ctrl+A" bringing up an "add" screen. Is this possible?
dteare
10-12-2004, 07:23 PM
Did you determine if you can do this? I haven't seen any examples like this yet.
--Dave.
johncorro
10-13-2004, 04:35 AM
Unfortunately, no. I went through the tutorials and can't seem to find any documentation on mapping your own shortcut keys.
mcgaffin
10-14-2004, 06:31 AM
Look at the LZX Reference (http://www.laszlosystems.com/lps-2.2/docs/reference/) for the LzKeys class. Although I haven't tried using this class myself, it looks like you set up a map to bind keystrokes to actions. I assume you can have different maps for different views, but then again, I'm not sure.
Hope that helps.
- david
antun
10-14-2004, 01:55 PM
I'm trying to enable something akin to "Ctrl+A" bringing up an "add" screen. Is this possible?
Absolutely, although some browsers will swallow certain key combinations. Ctrl + A might be one of those.
Check the LzKeys docs, and also have a look at the Tip of the Week forum - I think I might have posted an example there a while back.
-Antun
dteare
10-16-2004, 09:04 AM
I figured out how to make this work - thanks to this forum and to the brilliant idea of open-sourcing Laszlo!
Here's the code for the next poor newbie :)
<view name="AAA" focusable="true">
<method event="onkeydown" args="key">
Debug.write("Key pressed = " + key);
</method>
</view>
The hardest part was to make the view "focusable" - without that, no key events are sent to it.
I have a few unanswered question though:
1. How can I set a window to have focus? When the app first loads, I want a specific view to have focus.
2. How can I define "default" key events? Effectively, I want the canvas to always resond to the "Escape" key, regardless of who has focus.
Thanks!
--Dave.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.