systemwide Event event - key values?

Discuss OrbForms Designer and PocketC Architect

Postby design4use on Mon Jun 10, 2002 10:06 pm

There is a systemwide Event named event, that gets re-used in the sample applications. Nowhere there or in the docs can I find how to detect that a hardkey was pressed, what all the key values are etc.
The docs say it's possible but lack any useful examples. Help!
Thanks in adv,
+ G
Posts: 128
Joined: Fri May 10, 2002 3:31 pm

Postby design4use on Tue Jun 11, 2002 6:17 pm

found out on my own and want to share:

in app.onstart you hook the hard key events like so:
handler app.onstart() {

Preferences prefs;
// load the preferences
prefs.get("GDUI", false, &appPrefs, typeof(appPrefs), 1);
// load the main form
app.hookhard(true);//hook here

then you add a handler on the form you are interested in to capture the hardkeys like so:

handler mainForm.onhkey() {
//TODO: handle event
//event.key will be one of ev0, ev1, ev2, ev3, evUp, evDown.
//To receive this event for the four application buttons,
// you must first call UIApp.hookhard().
if (event.key == ev0) {
//alert("you pressed the 1. key");
if (event.key == ev1) {
//alert("you pressed the 2. key");
if (event.key == ev2) {
//alert("you pressed the 3. key");
if (event.key == ev3) {
//alert("you pressed the 4. key");
if (event.key == evUp) {
//alert("you pressed the up key");
if (event.key == evDown) {
//alert("you pressed the down key");

this seems to work...
Posts: 128
Joined: Fri May 10, 2002 3:31 pm

Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 1 guest