Page 1 of 1

Trapping down arrow with bKeyDown

Posted: Mon Apr 09, 2012 4:26 pm
by Rick Lipkin
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

Re: Trapping down arrow with bKeyDown

Posted: Tue Apr 10, 2012 11:23 am
by Demont Brecht
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

Re: Trapping down arrow with bKeyDown

Posted: Tue Apr 10, 2012 12:27 pm
by Rick Lipkin
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

Re: Trapping down arrow with bKeyDown

Posted: Tue Apr 10, 2012 10:45 pm
by FranciscoA
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.

Re: Trapping down arrow with bKeyDown

Posted: Wed Apr 11, 2012 12:51 am
by nageswaragunupudi
Mr Rick

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

Re: Trapping down arrow with bKeyDown

Posted: Wed Apr 11, 2012 1:51 pm
by Rick Lipkin
Francisco, Rao

Thank you both !

Rick