Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


D-Pad Navigation


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2008, 11:50 PM
Dave Mitchell's Avatar
Newbie
 
Join Date: Mar 2008
Posts: 8
Default D-Pad Navigation

I guess you need to walk before you run. I am trying to intercept the D-Pad key presses so I can hop around controls in a form. I have tried using ControlName_KeyPress (SpecialKey) but when I compile and run it on the PPC, nothing happens. I suspect this need is common but I can't find an example on the forum (not looking hard enough?). Can this be used for DPad navigation?
Thanks, Dave

Sub Globals
'Declare the global variables here.
End Sub

Sub App_Start
Form1.Show
form1.Focus
End Sub

Sub ControlName_KeyPress (SpecialKey)
Msgbox (SpecialKey)
End Sub
Reply With Quote
  #2 (permalink)  
Old 05-01-2008, 05:20 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,845
Default

The form never gets the focus if there are any other controls on it that can be focused.
One solution is to change the form's KeyPreview property using the Door library: Door library (Beta) - Special library (first example).
After adding this code you can use Form1_KeyPress event to handle the D-Pad buttons.
Reply With Quote
  #3 (permalink)  
Old 05-02-2008, 12:07 AM
Dave Mitchell's Avatar
Newbie
 
Join Date: Mar 2008
Posts: 8
Default

Thanks so much for the response. I still must not be getting it, the following code does not display any msgbox when the D-Pad keys are pressed.
Thanks, dave

' Uses door.dll, ofrm is an object
Sub Globals
'Declare the global variables here.
End Sub

Sub App_Start
Form1.Show
ofrm.New1(false)
ofrm.FromControl("Form1")
ofrm.SetProperty("KeyPreview",true)
End Sub

Sub ControlName_KeyPress (SpecialKey)
Msgbox (SpecialKey)
End Sub
Reply With Quote
  #4 (permalink)  
Old 05-02-2008, 06:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,845
Default

You should change Sub ControlName_KeyPress to Sub Form1_KeyPress.
Reply With Quote
  #5 (permalink)  
Old 05-02-2008, 10:46 PM
Dave Mitchell's Avatar
Newbie
 
Join Date: Mar 2008
Posts: 8
Default

Pretty silly. Thanks it works fine. Dave
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
D-Pad Navigation Sample (?) Dave Mitchell Questions & Help Needed 1 05-14-2008 05:29 AM
Forum Navigation dennishea Questions & Help Needed 1 02-15-2008 06:52 PM
Desktop IDE: Sub tree navigation minimal bug Woinowski Bug Reports 0 01-16-2008 07:20 AM
GPS map navigation and routing zen Questions & Help Needed 11 10-08-2007 06:44 AM


All times are GMT. The time now is 07:38 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0