FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper Focus oWnd
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 03: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Focus oWnd
Posted: Fri Dec 23, 2005 03:47 PM

Try oGet:SetFocus() instead.

EMG

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 04: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

Posts: 142
Joined: Sun Oct 09, 2005 10:59 AM
Focus oWnd
Posted: Fri Dec 23, 2005 05:04 PM

Try with SetActiveWindow(oWnd:hWnd)

Frank

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 05:25 PM

Thanks Frank,
I tried but with no success. Cursor remains in the get-field.
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Focus oWnd
Posted: Fri Dec 23, 2005 05:40 PM

Otto,

Try oGet:oJump := oWnd

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 05: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Focus oWnd
Posted: Fri Dec 23, 2005 07: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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 07: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Focus oWnd
Posted: Fri Dec 23, 2005 10:11 PM

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

EMG

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Fri Dec 23, 2005 10:44 PM

www.atzwanger.com/invoice/invoiceforemg.zip

Hallo Enrico,
I uploaded the file.
Regards
Otto

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Focus oWnd
Posted: Sat Dec 24, 2005 10:47 AM

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

EMG

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Focus oWnd
Posted: Sat Dec 24, 2005 02: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Focus oWnd
Posted: Sat Dec 24, 2005 02: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Focus oWnd
Posted: Sat Dec 24, 2005 05: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