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.


Menu handling with hardware keys


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-11-2007, 11:11 PM
Newbie
 
Join Date: May 2007
Posts: 9
Default Menu handling with hardware keys

I want to write an application which uses menus for opening different forms for use in rough environment and want to avoid using the stylus but rather the hardware keys for going through the menu.

Upon pressing the "hardware enter key" I want the child menu to appear just as if the word at the left bottom edge of the form had been pressed by the stylus.

And with the "hardware up key" and "hardware down key" I want to scroll through the child menu until I reach the selected child menu item. Just as on a desktop scrolling through a menu with the up/down buttons.

By pressing the hardware enter key I want to raise the click event just as if the child menu item had been marked with the stylus.

Who can help me.
Attached Files
File Type: sbp Menu_handling_with_hardkeys.sbp (1.2 KB, 23 views)
Reply With Quote
  #2 (permalink)  
Old 07-12-2007, 05:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

The Windows Mobile OS do not support this.
You will need to use other controls (maybe a ComboBox).
Reply With Quote
  #3 (permalink)  
Old 07-12-2007, 11:28 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Why not attach a context menu to a Form (as this example), or a large control? When the user presses it with his finger the context menu comes up and he can navigate it and accept his selection using the buttons.
Reply With Quote
  #4 (permalink)  
Old 07-12-2007, 11:47 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Sorry - I'm sure that I uploaded the zip but it didn't appear. Finger trouble probably - here it is.
Attached Files
File Type: zip Keymenu.zip (55.8 KB, 21 views)
Reply With Quote
  #5 (permalink)  
Old 07-12-2007, 09:41 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I've tried agraham's example but nothing seemed to happen, is this just on my device

Anyway, attached is some code that I've written to overcome your little problem.

Basically I've hidden a panel with three labels representing the menu items.
Press the Enter hardware button to display the Menu.
Up and Down to scroll through the menu choices.
Enter again to select the highlighted menu item or Left to close the menu.
Alternatively you can add another level of menu which could be accessed using a Right click.

Hope you like it. If it was possible to draw lines on a panel then I could have made it even more like the real menu which by the way still works.

Regards,
RandomCoder
Attached Files
File Type: zip Menu With Hardware Keys.zip (7.5 KB, 22 views)
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #6 (permalink)  
Old 07-13-2007, 09:27 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by RandomCoder View Post
I've tried agraham's example but nothing seemed to happen, is this just on my
Maybe it's because formlib.dll is not in the same directory. It needs it as it uses a context menu. I should have made that clear. Sorry.
Reply With Quote
  #7 (permalink)  
Old 07-13-2007, 09:43 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by RandomCoder View Post
If it was possible to draw lines on a panel then I could have made it even more like the real menu which by the way still works.
You could put a white panel on top of a slightly bigger black panel then put the labels on the white panel. That gives the appearance of a black border.
Reply With Quote
  #8 (permalink)  
Old 07-13-2007, 10:50 AM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Nice tip, I hadn't thought of doing it like that.

PS. I have the FormLib.dll included in the application folder but still nothing happens???

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #9 (permalink)  
Old 07-13-2007, 07:58 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,687
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by RandomCoder View Post
Nice tip, I hadn't thought of doing it like that
This is the way I get bordered panels in the full Compact Framework - an idea I stole from someone else! I have since realised that in this case, when the panel is full of controls anyway, the white panel is probably superfluous if the controls are carefully placed to touch each other.

Quote:
PS. I have the FormLib.dll included in the application folder but still nothing happens???
It's dead simple code, just a context menu bound to the form itself rather than a control. Ah! are you "touching" or "stabbing" rather than "pressing"? If you press then you get the round circle of dots then the context menu pops up. Same as right-click on the desktop.

You're way is neater than mine in that it uses the Enter key to bring up a menu but only lets you have one pop-up menu on the form. I hadn't looked at the hardware component properly. I knew that you could get some hardware key presses but didn't realise that the navigation keys were included in those.

Aging but still learning all the time!
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
Serial port handling mjcoon Questions & Help Needed 5 06-26-2008 11:48 AM
Game and keys pmu5757 Questions & Help Needed 13 06-01-2008 04:56 PM
Exceptions handling library agraham Additional Libraries 5 05-28-2008 12:52 PM
Error handling in Basic4PPC TWELVE Questions & Help Needed 8 05-14-2008 07:56 PM
Exception Handling Astragali Questions & Help Needed 2 05-23-2007 01:44 AM


All times are GMT. The time now is 02:12 PM.


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