Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 9:02 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Aug 03, 2011 9:27 am 
Offline

Joined: Wed Aug 03, 2011 8:44 am
Posts: 7
I'm using a G58 terminal and want to display a popup screen as soon as the user presses the <SHIFT><F1> key combination.
How can I declare this key combination and handle the request ?

Many thanks in advance !

Tony :-)


Top
 Profile  
 
PostPosted: Wed Aug 03, 2011 10:53 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
You can use a HotKeyV2 object to catch the key press and display the screen. The code might look something like this.

Code:
func handleKeyRelease()
    PopupScreen_1.enabled = true
endfunc


The HotKeyV2 has a "hotkeyvalue" property that needs to be configured for the shifted keys value. I know that with the 40-key keypad default settings, the shifted F1 key is the character 'A'. HotKeyValue in this case would need to be set to 'A' or 65.


Attachments:
File comment: Example workspace.
shift_f1_popup.qly [5.92 KiB]
Downloaded 149 times

_________________
Ron L.

http://www.beijerelectronicsinc.com/
Top
 Profile  
 
PostPosted: Thu Aug 04, 2011 4:40 am 
Offline

Joined: Wed Aug 03, 2011 8:44 am
Posts: 7
Ron,

thanks a lot ! That's what I call a quick reply.

I should have seen that <SHIFT><F1> corresponds letter 'A'. Now my popup window appears (almost) as expected.

Using <SHIFT><F1> I expected a non-printable output, similar like on a PC keyboard.

The side effect of this solution is that the window pops up every time the user enters an 'A' on the keyboard. This is not always desired. I also have some EditBoxV2 objects on the screen. It's not possible to enter there an 'A' now :-(

Is there a simple key combination on the G-58 to use instead ? What's good practice here ?
The idea behind the whole thing is to put some application-wide settings on an own screen and let this screen pop up with a key combination. I'm not restricted to <SHIFT><F1>, it was just an idea. Since I also use EditBoxes, I don't want to have a conflict.



The other question is the opposite of this one : how can I isolate the SHIFT key ?
I have a Button on the screen and it's action should look similar to

Code:
'Button Event
func click()
   if SHIFT_KEY_IS_PRESSED then
      Do_Some_Advanced_Stuff()
   else 'no <SHIFT> key pressed
      Do_Some_Stuff()
endfunc


How can I detect here if the <SHIFT> key is pressed on not ?

Thanks again.
Tony :roll:


Top
 Profile  
 
PostPosted: Thu Aug 04, 2011 7:49 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
One idea is to disable the HotKey when an EditBox has focus. The code in the EditBox would look something like this.

Code:
func focusOn()
    HotKey_1.enabled = false
endfunc

func focusOff()
    HotKey_1.enabled = true
endfunc


There is not a function to determine if the Shift key is shifted or not. To get that behavior you would need to do a fair amount of coding and make it so that you can toggle the shift key programatically as described in this topic.
viewtopic.php?f=6&t=168

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
PostPosted: Thu Aug 04, 2011 8:46 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
If I understand your problem what you want is: You would like a key to be a hotkey (for example 'A'), but only when you are not performing data entry (e.g. you are not actively entering data into an edit box).

If I understand this problem correctly, merely detecting whether the shift key was active during keypress is not enough. By virtue of the fact that the 'A' was generated, we know that the shift key was active during key press. (If it was not active, an F1 would have been generated. For what it is worth the GetKeyCodeInfo method of the hotkey could provide this information for you). If you mean actually held down at the time the the 'A' was generated, this is extremely difficult to detect and would mean manually taking control of a lot of the keypad mechanism in ways that I would be very hesitant to try in my code.

One thing that would be very easy to try, although I have no idea if it will work for you is to change the myPriority property of your hotkey to _low_priority. This should allow the edit box to get the 'A' if the edit box has focus, but if another object has the focus that does not processes an 'A' the hotkey will get it.

My next thought on this entire situation would be to see if there is a key on your keypad you could dedicate to being a full-time hot key. This would be far and away the easiest solution. For example the '*' key or perhaps one of the diagonal arrow buttons. If you never need to input a '*' then this should work nicely.

If that does not work we have a little work cut out for us. There are a couple of routes we could go here. One is to try and detect if the current focus object is an edit box in edit mode and have the hotkey reject the key in that case. The other would be to define a two-button key sequence that must be held down in order to trigger your popup. Both of these are slightly tricky to code but should be fairly doable.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group