FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trapping down arrow with bKeyDown
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Trapping down arrow with bKeyDown
Posted: Mon Apr 09, 2012 04:26 PM

To All

I am trying to trap the down arrow key in xbrowse .. I noticed in vkeys.ch there is not a value for the down arrow key.

When I use this function oLbxB:bKeyDown := { |nKey| _Manual( nKey,oRsDetail,oLbxB )} .. the function Manual does not return a value for nKey when the down arrow key is pressed.

I realize the arrow keys may be reserved, but is there a work around for trapping the down arrow key ?

Thanks
Rick Lipkin

Posts: 55
Joined: Fri Jul 08, 2011 06:43 AM
Re: Trapping down arrow with bKeyDown
Posted: Tue Apr 10, 2012 11:23 AM

Rick ,

If you have the intention to trap changing from row , you can use bChange as :

oBrw:lColChangeNotify := .T.
oBrw:bChange := {|oBrw,lRow|MyFunc(oBrw,lRow,@GehRec)}

MyFunc(oBrw,lRow,Gehrec)


IF lRow is .T. , there was a changing from row.

To know if it was the down or up arrow , you could check the procedure list (procnames(....))

FRank

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Trapping down arrow with bKeyDown
Posted: Tue Apr 10, 2012 12:27 PM

Frank

I am trying to re-create a VB application that needs a modern facelift. My goal is to duplicate the functionality of the application. In this case when the down arrow is used it navigates through the grid as xBrowse .. however when the arrow down is used on the last row, the grid appends a new record allowing for data entry to continue.

I was hoping to be able to trap the down arrow key and test for eof to be able to append a new row. This is a very desirable function in this program and one I would like to preserve.

I will study your suggestion and I appreciate your help!

Thanks
Rick

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Trapping down arrow with bKeyDown
Posted: Tue Apr 10, 2012 10:45 PM

Rick.
In my Fwxh ver 10.06 I can do as follow. Maybe, is what you are looking for?

oBrw:bPastEof = {|| If(MsgNoYes("Do you want to add a new record?","Add a new record"),;
(oServer:Query("INSERT INTO " + cAlias + " () VALUES() ;"),;
oAlias:Refresh(),oBrw:GoBottom(), oBrw:GoLeftMost(), oBrw:Refresh()),) }

Regards.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Trapping down arrow with bKeyDown
Posted: Wed Apr 11, 2012 12:51 AM

Mr Rick

oBrw:bPastEof is intended for this purpose.
You can implement this with oBrw:bPastEof and oRs:AddNew()

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Trapping down arrow with bKeyDown
Posted: Wed Apr 11, 2012 01:51 PM

Francisco, Rao

Thank you both !

Rick

Continue the discussion