|
-
Jul 30th, 2007, 10:17 AM
#1
Thread Starter
Addicted Member
[RESOLVED] PDA Up/Down/eft/right buttons
How can I get a vb.net mobile app to respond to the PDA buttons?
The following code appears to work when deployed to emulation but not when deployed to the device:-
Code:
Private Sub App_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If (e.KeyCode = System.Windows.Forms.Keys.Up) Then
'Rocker Up
'Up
End If
If (e.KeyCode = System.Windows.Forms.Keys.Down) Then
'Rocker Down
'Down
End If
-
Jul 31st, 2007, 04:58 AM
#2
Re: PDA Up/Down/eft/right buttons
Have a try with
e.keydata instead of e.keycode
Alternative you can try API. The keybd_event in coredll but i don't think you must complicate things without a reason.
Code:
<DllImport("coredll.dll", CharSet:=CharSet.Unicode)> _
Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub
Last edited by sapator; Jul 31st, 2007 at 05:02 AM.
-
Jul 31st, 2007, 08:10 AM
#3
Thread Starter
Addicted Member
Re: PDA Up/Down/eft/right buttons
The event fires when in emulation mode but not when it is deployed to the device. I'm using compact framework 1 and that does not support keypreview on a form.
If I try on framework 2 (which does support keypreview) it works, but to upgrade the app. to 2 is a load of hassle I could do without.
-
Aug 1st, 2007, 01:25 AM
#4
Re: PDA Up/Down/eft/right buttons
In a company i support they use CF 1 with key events on Smartphone 2003 so the keys most definitely work.
-
Aug 1st, 2007, 02:38 AM
#5
Thread Starter
Addicted Member
Re: PDA Up/Down/eft/right buttons
OK - solved it
The generated vb code for the keydown event was:-
Code:
Private Sub ABC_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
I changed it to :-
Code:
Private Sub ABC_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TabControl1.KeyDown
using the left right buttons changes the tab and using the up down buttons has the desired effect on the current tab.
I don't understand MYBASE anyway
Thanks for your advice and help
Regards
Barry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|