Test for Vertical Scroll hits EOF xBrowse ( rao )
Posted: Thu Jan 18, 2018 5:59 pm
Rao
I have an invoicing module that uses the code block bPastEof to trigger the AddNewRow function ..
What I have tried to do is add a MsgYesNo() at the top of AddNewRow() to ask the user if they ( really ) want to add a new Row to stop a run-away multiple add new blank rows.
Unfortunately, some of my users use the vertical scroll bar or the mouse wheel to move through the itemized rows and when the mouse wheel or vertical scroll bar hits bPastEof .. it triggers multiple calls to AddNewRow()
I have tried to trap the input and I want to let the DOWN ARROW KEY ONLY to fire the bPastEof :
Unfortunitly the bKeyDown or bKeyChar block does not fire and I can not prevent the screen shot you see below... Any advice would be helpful!
Thanks
Rick Lipkin

I have an invoicing module that uses the code block bPastEof to trigger the AddNewRow function ..
Code: Select all | Expand
// add a new record
oLbxB:bPastEof = {|| _AddNewRow( oRsDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"Y",oRsRepair,"" ) }
What I have tried to do is add a MsgYesNo() at the top of AddNewRow() to ask the user if they ( really ) want to add a new Row to stop a run-away multiple add new blank rows.
Code: Select all | Expand
//----------------
Static Func _AddNewRow( oRsDetail,nRN,nTech,cLocation,oBrw,cAsk,oRsRepair,cReturn )
Local Saying,nEid,nLine,nUpdated
If empty( cAsk )
cAsk := "Y"
Endif
If Empty(cReturn)
cReturn := "ADD"
ENdif
If cAsk = "Y"
Saying := "Do you wish to Add a New Record ?"
If MsgYesNo( Saying )
Else
oBrw:SetFocus()
Return(.f.)
Endif
Endif
// create new row and primary key
Unfortunately, some of my users use the vertical scroll bar or the mouse wheel to move through the itemized rows and when the mouse wheel or vertical scroll bar hits bPastEof .. it triggers multiple calls to AddNewRow()
I have tried to trap the input and I want to let the DOWN ARROW KEY ONLY to fire the bPastEof :
Code: Select all | Expand
oLbxB:bKeyDown := { |nKey| if(nKey = VK_DOWN, _AddNewRow( oRsDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"Y",oRsRepair,"") , )}
oLbxB:bKeyChar := { |nKey| MsgInfo(nKey) }
// add a new record
oLbxB:bPastEof = {|| _AddNewRow( oRsDetail,nRepairNumber,nAssignedTo,cLoc,oLbxB,"Y",oRsRepair,"" ) }
Unfortunitly the bKeyDown or bKeyChar block does not fire and I can not prevent the screen shot you see below... Any advice would be helpful!
Thanks
Rick Lipkin
