Focus oWnd

User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Focus oWnd

Post by Otto »

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: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Post by Frank Demont »

Try with SetActiveWindow(oWnd:hWnd)


Frank
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thanks Frank,
I tried but with no success. Cursor remains in the get-field.
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

Try oGet:oJump := oWnd
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

www.atzwanger.com/invoice/invoiceforemg.zip

Hallo Enrico,
I uploaded the file.
Regards
Otto
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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

EMG
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Post Reply