Focus oWnd

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

Post by Otto »

Thanks Antonio,
is it possible to group all the code for browsing in a own control, so that I have on one hand the get-fields and on the other the browse.
Regards
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,

Yes, of course. You may use source\classes\TPanel.prg as a skeleton to build your own browse control, so your browse will just respond to input events when it has the focus.

You may need to add it the WS_TABSTOP style.
regards, saludos

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

Post by Otto »

Hello Antonio,

TPanel works.

Where I have problems is with the up,down,left,right-keys.
Do I have to change twindow?

I don't know how to use: WS_TABSTOP style
so I tried to do it with the VALID case.
Is this a bad solution?

You find my code on http://www.atzwanger.com/invoice/invoiceFor Antonio.zip

@ 1 , 1 GET oGet VAR cTest OF oPanelAddress SIZE 100,17 VALID (oPanelBody:SetFocus(),.t.)


Thanks in advance
Otto



METHOD KeyDown( nKey, nFlags ) CLASS TWBrowse

do case
case nKey == VK_UP
::GoUp()

case nKey == VK_DOWN
::GoDown()

case nKey == VK_LEFT
::GoLeft()

case nKey == VK_RIGHT
::GoRight()

case nKey == VK_HOME
::GoTop()

case nKey == VK_END
::GoBottom()

case nKey == VK_PRIOR
if GetKeyState( VK_CONTROL )
::GoTop()
else
::PageUp()
endif

case nKey == VK_NEXT
if GetKeyState( VK_CONTROL )
::GoBottom()
else
::PageDown()
endif

otherwise
return Super:KeyDown( nKey, nFlags )
endcase

return 0
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

> Where I have problems is with the up,down,left,right-keys.
> Do I have to change twindow?

You have to define Method KeyDown() for your news class. There is no need to modify TWindow.

I can't download: You find my code on http://www.atzwanger.com/invoice/invoiceFor Antonio.zip

Please provide a valid link. Thanks.
regards, saludos

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

Post by Otto »

Hello Antonio,
sorry for the wrong link.
I hope thisone works:


http://www.atzwanger.com/invoice/invoiceForAntonio.zip

At the moment it is only a programm not a class - I don't know how to make one - and I tried with:
oPanelBody:bkeyChar := {|nKey|Msginfo(str(nKey))}
But I get no value for the arrowkeys.
regards
Otto
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Antonio,
thank you for your help.
Now I can do what I want.
Only a little problem still exists:

I don't know how to use: WS_TABSTOP style
so I tried to do it with the VALID case.
This way I can't return from what I call panelBody to the panelHeader with the keyboard.
Regards,
Otto

http://www.atzwanger.com/invoice/invoic ... 051226.zip
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

What I was meaning is to create a new class, using TPanel as a sample, for a user defined control, where you paint, process input (keyboard, mouse), etc.

That class should have the style WS_TABSTOP so you can use the tab to set the focus to it and to go to other controls.
regards, saludos

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

Post by Otto »

Now I have a nice homework,

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

Post by Otto »

Hello Antonio,

I tried your suggestion and so fare it is working.
The only problem is how to switch between the address-panel and the browser-panel.

Could you please help me on that again.

LINK: www.atzwanger.com/invoice/invoiceForAntonio_2.zip

Thanks in advance

Otto
Post Reply