bKeyDown-RETURN is not processed, another event may be used?

bKeyDown-RETURN is not processed, another event may be used?

Postby xVar » Thu Apr 09, 2009 12:53 pm

Hi!

I try write code for event when RETURN key is pressed on window ( window have not any input elements ) .
In bKeyDown events every key is processed , but RETURN is not.


What event block may be used for this?

Reagards
Andrej


It is my code:


function Main()
LOCAL cSearch:=""

DEFINE WINDOW oWnd TITLE "KEYTEST"
@ 1,1 SAY oSay PROMPT cSearch SIZE 80, 30


oWnd:bKeyChar = { | nKey | Search( nKey, @cSearch ),;
oSay:Refresh() }

oWnd:bKeyDown = { | nKey | Search( nKey, @cSearch ),;
oSay:Refresh() }

ACTIVATE WINDOW oWnd
return nil


function Search( nKey, cSearch )

if nKey == 8
cSearch := SubStr( cSearch, 1, Len( cSearch ) - 1 )
elseif nKey==27
cSearch :=""
else
cSearch += Upper( Chr( nKey ) )
endif
MsgInfo(str(nKey))

return nil
xVar
 
Posts: 35
Joined: Mon Jan 19, 2009 9:14 am

Re: bKeyDown-RETURN is not processed, another event may be used?

Postby Enrico Maria Giordano » Thu Apr 09, 2009 9:10 pm

You can use the VALID clause or bLostFocus codeblock instead, and eventually test the pressed key using GetKeyState().

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: bKeyDown-RETURN is not processed, another event may be used?

Postby Antonio Linares » Thu Apr 09, 2009 10:48 pm

Andrej,

As you have created a child control, then those events get routed to that child control.

If you comment out this line:

// @ 1,1 SAY oSay PROMPT cSearch SIZE 80, 30

then the main window should properly process those events.

You can use oWnd:Say( nRow, nCol, cText, ... ) to paint on the window instead of using a SAY control there.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: bKeyDown-RETURN is not processed, another event may be used?

Postby xVar » Mon Apr 20, 2009 7:09 am

Thanks!
I will try this.
Andrey
xVar
 
Posts: 35
Joined: Mon Jan 19, 2009 9:14 am


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 23 guests