Focus oWnd

Focus oWnd

Postby Otto » Fri Dec 23, 2005 3:27 pm

I have a window with oGets, oSays and other controls.

I would like to control the input with:

oWnd:bkeyChar :={|nKey|iif( nKey == K_LEFT, msginfo("TASTE") )}

But after the first keystroke or if I insert some text in a get-field
I am not able to bring back focus to oWnd.

I tried oWnd:SetFocus() but with no success.

Also up-, down-, right-, left-key does not give back a value.

Thanks in advance
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: Focus oWnd

Postby Enrico Maria Giordano » Fri Dec 23, 2005 3:47 pm

Try oGet:SetFocus() instead.

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

Postby Otto » Fri Dec 23, 2005 4:48 pm

Enrico, thank you for your help. But I don’t need focus on the get-field.
What I would like is to navigate the browser with the keys.
At the moment I only can use the mouse.
If you have time please see the screen capture.

If I enter something into the address I can’t pass focus back to the window itself.

Also cursor-key do not work.

www.atzwanger.com/invoice/for_emg.jpg

Thanks in advance
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Frank Demont » Fri Dec 23, 2005 5:04 pm

Try with SetActiveWindow(oWnd:hWnd)


Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Otto » Fri Dec 23, 2005 5:25 pm

Thanks Frank,
I tried but with no success. Cursor remains in the get-field.
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Fri Dec 23, 2005 5:40 pm

Otto,

Try oGet:oJump := oWnd
regards, saludos

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

Postby Otto » Fri Dec 23, 2005 5:58 pm

Antonio,

I put a small example on:

www.atzwanger.com/invoice/invoiceWithGet.zip

If you comment
// @ 1 , 1 GET oGet VAR cTest OF oWnd SIZE 75,17

keys work - up/down/left/right do not work.

With the getfield I only can use the mouse to navigate.
Regards
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Fri Dec 23, 2005 7:04 pm

Sorry but with your sample I can't use the arrow keys to navigate the browser at all. I can't even keep the focus off the get.

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

Postby Otto » Fri Dec 23, 2005 7:31 pm

Sorry Erico,

oWnd:bkeyChar :={|nKey|iif( nKey == K_ENTER , msginfo("ENTER"), msginfo(str(nKey)) )}

was only to show, that up/down/left/right don't return a value.

Change to:

oWnd:bkeyChar :={|nKey|iif( nKey == K_ENTER ,( oWnd:oVScroll():SetPos( nPos:=nPos+1),f_code()) ,)}

Comment the oGetLine and delete oGet:oJump := oWnd

than you can navigate down with the Enter-key.

On click shows the record .

Saluti
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Fri Dec 23, 2005 10:11 pm

Can you send me the fixed sample? I can't get it to work.

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

Postby Otto » Fri Dec 23, 2005 10:44 pm

www.atzwanger.com/invoice/invoiceforemg.zip

Hallo Enrico,
I uploaded the file.
Regards
Otto
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Sat Dec 24, 2005 10:47 am

Do I have to uncomment the GET? Can you explain what is exactly the problem?

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

Postby Otto » Sat Dec 24, 2005 2:00 pm

Enrico,
does the exe work on your side.
If yes you can scroll down with the enter-key or with a mouse-click on the scrollbar.
but if you have a getfield -for example to get the address - on the window too, focus is on the getfield and you can't navigate anymore with the keys.

I had a look at the wbrowse class maybe I have to make a control out of this source. But I never worked with classes.
I changed the wbrowse-class like this:
Inserted the method: ShowSomething
But there is no text on the screen.

I wish you a Merry Christmas.

Otto

METHOD ShowSomething() CLASS TWBrowse
local oWnd:= ::oWnd
@ 5,5 Say "TEST NEU" of oWnd

@ 15,15 Say "TEST NEU" of ::oWnd
@ 25,25 Say "TEST NEU" of oWnd


@ 35,35 Say "TEST NEU" of oWnd

@ 55,55 Say "TEST NEU" of oWnd

::oWnd:say( 0, 0, "TESTTSTSTSTSS" ,255,16777215,::oFont,.T.)
::oWnd:say( 50, 50, "TESTTSTSTSTSS",255,16777215,::oFont,.T.)

::oWnd:say( 5, 5, "TESTTSTSTSTSS" ,255,16777215,::oFont,.T.)
return nil
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Sat Dec 24, 2005 2:06 pm

Now I understood. No, you can't trap the arrow keys when the focus in on a GET, as far as I know.

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

Postby Antonio Linares » Sat Dec 24, 2005 5:37 pm

Otto,

If there is a control on the window, then it will have the focus, and the input events (keystrokes, mouse) will get routed to it.

If you need to edit on the screen, you may use a GET, but you need to destroy it, or to hide it, once you are finish with it, so the input events will not go through it.

Your code is ok. I guess you are close to get what you want.
regards, saludos

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

Next

Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 17 guests

cron