xBrowse TAB navigation wish

xBrowse TAB navigation wish

Postby Rick Lipkin » Wed May 02, 2012 7:16 pm

To All

It would be nice if the TAB key would navigate through a row ( cell to cell ) much like the right arrow key ..

I have been looking at xBrowse.prg .. if someone could tell me how to modify the navigation keys, I would be most grateful.

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse TAB navigation wish

Postby frose » Fri May 04, 2012 5:48 am

Rick,

write your own method 'KeyDown()', like:

Code: Select all  Expand view
CLASS ClTXBrowse FROM TXBrowse
   CLASSDATA lRegistered AS LOGICAL
   METHOD KeyDown()
ENDCLASS

METHOD KeyDown( nKey, nFlags ) CLASS ClTXBrowse
   // subtyping, polymorphism or overriding the Method in the class TXBrowse (xbrowse.prg)
     IF nKey == VK_RIGHT
...
 
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse TAB navigation wish

Postby Antonio Linares » Fri May 04, 2012 6:20 am

Rick,

Tab is a key that in Windows is used to change the focus to the next control. You can modify its behavior if you want to, but your app will not behave as a Windows app :-)

In case you want to, simply assign oBrowse:bKeyDown = { | nKey | MsgInfo( nKey ) } and check if you get the MsgInfo() when you press it.
regards, saludos

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

Re: xBrowse TAB navigation wish

Postby Rick Lipkin » Fri May 04, 2012 12:26 pm

Antonio

The Tab key is ignored using the bKeyDown code block :cry: .. However, I did add this code to the nKeyDown method in xBrowse and it works quite nicely... but I do not like modifying FWH code because it makes it difficult to upgrade.

Antonio .. is there an easier way to subtype this method in my code without having to modify xBrowse ?


Rick

Code: Select all  Expand view

case nKey == VK_TAB        // added  rick lipkin

      if GetKeyState( VK_CONTROL )
         ::GoRightMost()
      else
         ::GoRight()
      endif

 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse TAB navigation wish

Postby nageswaragunupudi » Fri May 04, 2012 4:19 pm

Subclassing xbrowse is the easiest of all.

fwh\samples\xbrchild.prg explains how to subclass xbrowse.prg
Once you have made your own subclass say TXBrowseRick, then at the beginning of your project

SET XBROWSE TO TXBrowseRick()

All xbrowse commands in your entire application will now refer to TXBrowseRick().

In case you still adopt the syntax " oBrw := TXBrowse():New()", please change all those statements to "oBrw := TXBrows():New(oWnd)"

PS: I too personally recommend not to modify the Windows' native behavior.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse TAB navigation wish

Postby Rick Lipkin » Fri May 04, 2012 4:53 pm

Rao, Antonio

Just to test the behavior of the tab key, I opened MS Excel 2003 and hi-lited the first cell and hit the tab key and the cursor moved to the right to the next cell just like using the right arrow key.

The same behavior can be duplicated in Access as well .. Open a table and you can verify that tab navigates to the right of the current row within the grid.

I also verified the default cursor movement inside an active cell of both Excel and Access .. when data is in an active cell data is inserted from the cursor-right ( like having the insert key active ) rather than in an over-strike mode.

I can live with making the changes myself and do not want to cause any un-forseen changes that may give other developers any problems.

As Always .. I appreciate everyone help and support.

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse TAB navigation wish

Postby Antonio Linares » Fri May 04, 2012 6:17 pm

Rick,

I have reviewed Class TXBrowse, TControl and TWindow and there are several places in Method KeyDown() where we assume that VK_TAB is going to be used to switch focus between controls.

If you can modify the method yourself, that would be the easier, or as Rao has pointed, you can always inherit a new Class from TXBrowse and modify the method so when you upgrade to a more recent FWH, your code will continue working fine :-)
regards, saludos

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

Re: xBrowse TAB navigation wish

Postby Rick Lipkin » Fri May 04, 2012 8:37 pm

Antonio

Thank you for personally looking into this .. I appreciate all your help and advice.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jair and 51 guests