Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Something about Hardkey

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-26-2007, 07:02 AM
Junior Member
 
Join Date: Jun 2007
Posts: 16
Default Something about Hardkey

In a background app,I can use hk.new1("form1",false,true,true) to catch the keypress event of the hardware keys,as we all know.
in sub hk_HardKeyPressed,I want to catch hk.Key1 pressed,I can wtire this :
Select hk.KeyPressed
case hk.Key1
msgbox("Key1 was pressed")
...
ens select
so,when user pressed key1,he will get a message "key1 was pressed" and the default action assigned to key1(for example :run note.exe) would be canceled,but what I need is,how can I do this like this:
Select hk.KeyPressed
case hk.Key1
if checkbox1.checked=true then
msgbox("Key1 was pressed")
else
(run the default app asigned to key1)
...
ens select
Reply With Quote
  #2 (permalink)  
Old 10-26-2007, 07:16 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You will need to find the applications paths in the registry.
If I remember correctly you can find them under: LocalMachine\SOFTWARE\Microsoft\Shell\Keys
Reply With Quote
  #3 (permalink)  
Old 10-26-2007, 07:39 AM
Junior Member
 
Join Date: Jun 2007
Posts: 16
Default

Quote:
Originally Posted by Erel View Post
You will need to find the applications paths in the registry.
If I remember correctly you can find them under: LocalMachine\SOFTWARE\Microsoft\Shell\Keys
If the hardwarekey was assigned to a .exe file,I can use registry to find what to do, But Sometimes,hardwarekey is not assigned to an application,but be assigned to some "operate" (such as "open Startmenu,press ok button,show SIP,rotate screen" and so on),so we can not found something to shell.
maybe we need a founction like "hk.DoDefaultAction" or "hk.CancelCatch"(stop catch the keypress event of the hardware keys.)
Reply With Quote
  #4 (permalink)  
Old 06-11-2010, 09:45 AM
konisek's Avatar
Knows the basics
 
Join Date: Jan 2009
Posts: 52
Default

After using HardKeyPressed I cannot move cursor to the left in a textbox while pressing the HW button LEFT. How can I do it?

Code:
Sub hk_HardKeyPressed
Select hk.KeyPressed
Case hk.KeyEnter <i>'action while pressing ENTER</i>
   'do something
    ...
Case hk.KeyLeft <i>'action while pressing LEFT</i>
   'move cursor to the left
   TextBox3.Focus
   <b><font color=
"Blue">MOVE CURSOR TO THE LEFT</font></b>
End select
End Sub
Reply With Quote
  #5 (permalink)  
Old 06-11-2010, 10:24 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

You can do it that way:
Code:
<font face="Courier New"><font size="2"><font face="Courier New"><font size="2">TextBox1.Focus</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">If</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> TextBox1.SelectionStart></font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Then</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2">  TextBox1.SelectionStart=TextBox1.SelectionStart-</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">1</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">If</font></font></font>
</font></font></font></font></font></font>
Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #6 (permalink)  
Old 06-11-2010, 11:10 AM
konisek's Avatar
Knows the basics
 
Join Date: Jan 2009
Posts: 52
Default

Super, it works great. I just thought there was a code like
Code:
hk1.KeyPress(asc("A")) 'Writes a
even for cursor "move left".
But cannot use it for "move up" or "move down".
Thanx anyway.
L.

Last edited by konisek : 06-11-2010 at 11:17 AM.
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 Off
Pingbacks are Off
Refbacks are On


All times are GMT. The time now is 02:53 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0