FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse TAB navigation wish
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
xBrowse TAB navigation wish
Posted: Wed May 02, 2012 07: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

Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 05:48 AM
Rick,

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

Code (fw): Select all Collapse
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 06: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 12:26 PM
Antonio

The Tab key is ignored using the bKeyDown code block :-) .. 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 (fw): Select all Collapse
case nKey == VK_TAB        // added  rick lipkin

      if GetKeyState( VK_CONTROL )
         ::GoRightMost()
      else
         ::GoRight()
      endif
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 04: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 04: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 06: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
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse TAB navigation wish
Posted: Fri May 04, 2012 08:37 PM

Antonio

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

Rick Lipkin

Continue the discussion