xBrowse TAB vs ENTER key EDIT_GET ( rao )

xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Wed Jun 21, 2017 8:00 pm

Rao

Recently something has changed with xBrowse with the EDIT_GET block .. using :lTabLikeExcel := .t. .. when I put a price 69.95 in this block :
Code: Select all  Expand view

//  Price
      oLbxB:aCols[8]:nEditType := EDIT_GET
       oLbxB:aCols[8]:bOnPostEdit := {|o,p| _GetPrice( p,oLbxB,oRsDetail,oRsRepair,lTaxable,oTaxable,;
                                                      oLabor,oParts,oMisc,oTax,oTotal,cTaxSet) }
 


and Hit the TAB key .. the block resolved 69.00 .. If I hit the ENTER key, the block resolves 69.95 ... I am using FWH 1705 ... this behavior recently showed up either in 1705 or 1704.

Appreciate your help!

Rick Lipkin
Last edited by Rick Lipkin on Fri Jun 23, 2017 4:33 pm, edited 2 times in total.
User avatar
Rick Lipkin
 
Posts: 2606
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby nageswaragunupudi » Thu Jun 22, 2017 5:23 pm

There is no change in xbrowse code.
I am unable to comment because I do not know what is inside the postedit code.

It is desirable and safer if we leave XBrowse to work with its own default codeblock for bOnPostEdit.
If you write your own codeblock you should be able to resolve these complexities

If we press Enter key, any pending edit is confirmed
If we press TAB, if there is any pending edit, CancelEdit() is called and the cursor moves to the next cell
Regards

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Fri Jun 23, 2017 1:39 pm

Rao

My code has not changed in years .. here is what is happening .. I tab thru the cells to the Price column .. I enter 69.95 as you see here

Image

Then when I hit the TAB key ... and I pass P to the EDIT_GET code block and I trap the value with msginfo

Image

The value for the decimals is truncated to .00 ...

Image


If I repeat the same process and use the Enter key I get the expected 69.95 with the full decimal ... here is the code block that has not changed ...
Code: Select all  Expand view

 //  Price
          oLbxB:aCols[8]:nEditType := EDIT_GET
          oLbxB:aCols[8]:bOnPostEdit := {|o,p| _GetPrice( p,oLbxB,oRsDetail,oRsRepair,lTaxable,oTaxable,;
                                                      oLabor,oParts,oMisc,oTax,oTotal,cTaxSet) }
          // extention
          ADD oCol TO oLbxB AT 9 DATA {|x| x :=  _CalcExt( oRsDetail:Fields("Qty"):Value,;
                                    oRsDetail:Fields("Price"):Value )} HEADER 'Ext' size 65
          oLbxB:aCols[9]:nEditType := EDIT_NONE
          oLbxB:aCols[9]:nDataStrAlign := AL_RIGHT
          oLbxB:aCols[8]:nHeadStrAlign := AL_RIGHT


//--------------------------------
Static Func  _GetPrice( nP,oLbxMain,oRsDetail,oRsRepair,lTaxable,oTaxable,;
                        oLabor,oParts,oMisc,oTax,oTotal,cTaxSet)

Local nOldPrice,nQ,Saying

msginfo(nP) // nP should be 69.95 .. not 69.00


If oRsDetail:Fields("IsLabor"):Value = .t.
   Saying := "Sorry .. you can not EDIT this Price because there is Itemization"+chr(10)
   Saying += "under the Labor Column. In order to Change this Price you must go"+chr(10)
   Saying += "back to the Labor column and Edit or Delete your Changes there"+chr(10)
   MsgInfo( Saying )
   oLbxMain:GoLeftMost()
   oLbxMain:nColSel(2)
   Return(.f.)
Endif

nOldPrice := oRsDetail:Fields("Price"):Value
nQ        := oRsDetail:Fields("Qty"):Value

If nP = nOldPrice
   oLbxMain:ReFresh()
   oLbxMain:nColSel(2)
   oLbxMain:SetFocus()
   Return(.t.)
Endif

oRsDetail:Fields("Price"):Value := nP
oRsDetail:Update()

_ReCalcTotals( oRsDetail,oRsRepair,@lTaxable,oTaxable, ,oLbxMain,;
                        oLabor,oParts,oMisc,oTax,oTotal,cTaxSet  )

oLbxMain:ReFresh()
oLbxMain:nColSel(2)
oLbxMain:SetFocus()

Return(.T.)

//--------------------------------------
Static Func _CalcExt( nQuantity,nPrice )

//recalcs ext to paint listbox

Local nExtension

nExtension := Round((nQuantity * nPrice),2)

Return( nExtension )

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby nageswaragunupudi » Fri Jun 23, 2017 3:13 pm

What was the existing value before entering 69.95?

The behavior of xbrowse is this:
If you press Enter, you will see 69.95
If you press Tab, you will see the value existing already
Regards

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Fri Jun 23, 2017 3:42 pm

Rao

This was a new row created by the function _AddNewRow() .. the value of Price was 0 before anyone traverses into the cell.

Rick Lipkin



Code: Select all  Expand view

//----------------
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

nEid := _GenEid(1)
If nEid = -1
   Saying := "Error in Creating Unique EID for Repair Detail"
   Msginfo( Saying )
   oBrw:SetFocus()
   Return(.f.)
Endif

nLine := _GenLine()
If nLine = -1
   Saying := "Error in Creating Unique LINE for Repair Detail"
   Msginfo( Saying )
   oBrw:SetFocus()
   Return(.f.)
Endif

// update the concurrent counter in repair header

nUpdated := oRsRepair:Fields("Updated"):Value

If Empty(nUpdated)
   nUpdated := 1
Else
   nUpdated++
Endif

oRsRepair:Fields("Updated"):Value := nUpdated
oRsRepair:Update()

oRsDetail:AddNew()

oRsDetail:Fields("RepDetailEid"):Value     := nEid
oRsDetail:Fields("Unique Line"):Value      := nLine
oRsDetail:Fields("Repair Number"):Value    := nRn

If cReturn = "RETURN"
   oRsDetail:Fields("Qty"):Value              := -1
Else
   oRsDetail:Fields("Qty"):Value              := 1
Endif

oRsDetail:Fields("Item Description"):Value := space(100)
oRsDetail:Fields("Price"):Value            := 0                              // <---------------------   here is the value of Price
oRsDetail:Fields("Tech Number"):Value      := nTech
oRsDetail:Fields("Inventory Id"):Value     := space(50)
oRsDetail:Fields("Inventory Type"):Value   := space(50) //"Labor"+space(45)
oRsDetail:Fields("Cost"):Value             := 0
oRsDetail:Fields("Covered By Warranty"):Value := .f.
oRsDetail:Fields("Location"):Value         := cLocation
oRsDetail:Fields("Code"):Value             := space(25)
*oRsDetail:Fields("Shipping Ref"):Value     := space(64)
oRsDetail:Fields("Serial Number"):Value    := space(50)
oRsDetail:Fields("NoTax"):Value            := 0
oRsDetail:Fields("Warranty Provider"):Value := space(50)
*oRsDetail:Fields("Quote Price"):Value      := 0
oRsDetail:Fields("LockedDown"):Value       := .f.
oRsDetail:Fields("IsSerial"):Value         := .f.
oRsDetail:Fields("IsLabor"):Value          := .f.
oRsDetail:Update()

oBrw:ReFresh()
oBrw:nColSel(3) // move to part number on add
oBrw:SetFocus()

Return(.t.)

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Fri Jun 23, 2017 3:51 pm

Rao

You were on the right track ... I added 0.00 ( decimal ) to Price in _AddNewRow() .... and now it WORKS !!

Thanks for pointing me in the right direction ..

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao ).. SOLVED

Postby nageswaragunupudi » Fri Jun 23, 2017 3:57 pm

The best way is to test with as small program as possible
I am testing with this program
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   XBROWSER "CUSTOMER.DBF" FASTEDIT ;
      COLUMNS "FIRST", "SALARY", "CITY" ;
      TITLE FWVERSION ;
      SETUP ( oBrw:lTabLikeExcel := .t., ;
      oBrw:Salary:lAutoSave := .f., ;  // toggle and check
      oBrw:Salary:bOnPostEdit := { |o,x,k| MsgInfo( x ) } )

return nil
 

I find difference in the behavior between 17.03 and 17.05.
I try to locate the change and let you know.
I did not save 17.04 version.
Regards

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Fri Jun 23, 2017 4:04 pm

Rao

Unfortunately adding 0.00 to Price in _AddNewRow() made NO difference ... I still get 69.00 when I trap the EDIT_GET code block value nP ... :)

Rick Lipkin

ps I just updated to FWH 1706 a few minutes ago
User avatar
Rick Lipkin
 
Posts: 2606
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Fri Jun 23, 2017 4:52 pm

Rao

I just compiled your sample and changed the Salary to 69.95 and Tabbed thru the cell and your msginfo resolved 69.00 instead of 69.95... and the previous existing value decimal value was .00

At least we are able to re-create the tabbed behavior.

Rick Lipkin

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Mon Jun 26, 2017 7:37 pm

Rao

Any News ?

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby nageswaragunupudi » Tue Jun 27, 2017 4:16 am

Mr Rick
I need some more time please
Regards

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Thu Jul 13, 2017 2:33 pm

Rao

Hope you enjoyed the conference ... have you had a chance to re-examine this issue ?

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Tue Jul 25, 2017 12:25 pm

Rao

Forgive me .. just wanted to keep this on your radar ... Thanks for your Help !

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby nageswaragunupudi » Sat Jul 29, 2017 4:32 pm

Sorry for the delay.

Please locate static function EditGetkeyDown( Self, nKey ) in xbrowse.prg.
In that function please locate the code
Code: Select all  Expand view
     case nKey == VK_RETURN

Modify this line as
Code: Select all  Expand view
     case nKey == VK_RETURN .or. nKey == VK_TAB


Please let us know the result
Regards

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

Re: xBrowse TAB vs ENTER key EDIT_GET ( rao )

Postby Rick Lipkin » Mon Jul 31, 2017 2:17 pm

Rao

case nKey == VK_RETURN was found in two places

1) KeyChar()
2) EditGetKeyDown()

I made the change in both places to case nKey == VK_RETURN .or. nKey == VK_TAB

You modification WORKED !!

Thank You VERY Much

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 9 guests