xBrowse cell edit

xBrowse cell edit

Postby MarcoBoschi » Wed Dec 21, 2016 8:56 am

In a xbrowse I have some columns defined in this way
Code: Select all  Expand view  RUN

  oCol = oBrw:AddCol()
   oCol:bStrData    = { || field->name }
   oCol:cHeader     = "Nome"
   oCol:nEditType   = EDIT_GET
   oCol:bOnPostEdit = { | oCol, xVal, nKey | makerep( "field->name", nkey, oBrw, xVal ) }
   oCol:nWidth      = 200
 

I receive a request: when I digit some characters into one cell and than I click with mouse
on another place of my program (lost focous) in makerep function xVar has no value.
If a exit from cell using the keyboard has the value.
How can I modify mo code in order to keep the entered value?
Bye
marco
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: xBrowse cell edit

Postby Rick Lipkin » Wed Dec 21, 2016 2:37 pm

Marco

I confirm this behavior as well .. unless you use <tab> or <enter> the input buffer is not captured especially if you get distracted and have to move the focus.

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

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Dec 22, 2016 3:49 am

How can I modify mo code in order to keep the entered value?

This is not possible now. The moment Get loses focus, the Get ends().
Options available are either to lose the changes (default) or save the changes when Get loses focus. Former option is safe and second option can lead to erroneous input.
This is the present behavior.
And I may inform you that changing this behavior is not going to be easy.
Regards

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

Re: xBrowse cell edit

Postby Gale FORd » Thu Dec 22, 2016 4:02 am

Excel saves the value if you click on another cell while entering data. I tried using xbrowse on entry screen where I used tsbrowse before and users were complaining about not saving entry. They would not always remember to press enter or tab before the save button.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Dec 22, 2016 4:17 am

oCol:lAutoSave may be set to .T.
or
oBrw:lAutoSaves may be set to .T.
Regards

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

Re: xBrowse cell edit

Postby MarcoBoschi » Thu Dec 22, 2016 10:29 am

Code: Select all  Expand view  RUN
oCol:lAutoSave may be set to .T.

Oh Very Good!
Many thanks
Marco
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: xBrowse cell edit

Postby AntoninoP » Thu Jun 15, 2017 9:49 am

Hi,
I am trying with FWH 15.3 and lAutoSave does not works.
I modified xbrwedit.prg in this way
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oWnd, oBrw, oCol

   USE Customer
   ZAP

   DEFINE WINDOW oWnd
   
   @ 0, 0 XBROWSE oBrw OF oWnd ALIAS "Customer"
   
   oBrw:lFastEdit = .T.
   
   oCol = oBrw:AddCol()
   oCol:bStrData    = { || Customer->First }
   oCol:cHeader     = "First"
   oCol:nEditType   = EDIT_GET
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->First := xVal,) }
   oCol:lAutoSave   = .T.

   oCol = oBrw:AddCol()
   oCol:bStrData    = { || Customer->Last }
   oCol:cHeader     = "Last"
   oCol:nEditType   = EDIT_GET
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( RecCount() == 0, DbAppend(),), If( nKey == VK_RETURN, ( Customer->Last := xVal, DbAppend(), oBrw:Refresh() ),) }
   oCol:lAutoSave   = .T.
   
   oBrw:CreateFromCode()
   
   oWnd:oClient = oBrw

   ACTIVATE WINDOW oWnd

return nil
 


(added oCol:lAutoSave = .T.)

is there a bugfix in the newest version?

Thanks,
Antonino
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Jun 15, 2017 9:52 am

What are you expecting from AutoSave?
Regards

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

Re: xBrowse cell edit

Postby AntoninoP » Thu Jun 15, 2017 10:34 am

I expecting that when write something during editing and you click outside the value is saved.
for example
Image
I expecting that the value remains...
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Jun 15, 2017 10:39 am

But your postedit block insists that the last key should be VK_RETURN.

I suggest coding XBROWSE fully in command style, using COLUMNS clause. You can see any of the many samples I posted in the forums. Everything will work the way expected. That is our officially recommended way of coding to get the full benefit of xbrowse.
Regards

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

Re: xBrowse cell edit

Postby AntoninoP » Thu Jun 15, 2017 10:42 am

and why the provided example does not works?....
It is not my postedit it is yours...
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Jun 15, 2017 10:50 am

I mean the code written for postedit block.

If we use COLUMNS syntax XBrowse automatically generates a bOnPostEdit codeblock.
I need to go out for a while
When I am back I will post a working sample
Regards

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

Re: xBrowse cell edit

Postby AntoninoP » Thu Jun 15, 2017 11:26 am

If I change the bOnPostEdit it works as expected, (replacing nKey == VK_RETURN with nKey != VK_ESCAPE)
But I am not able to do it in my code, I will check again.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: xBrowse cell edit

Postby nageswaragunupudi » Thu Jun 15, 2017 11:31 am

We suggest this code;
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

REQUEST DBFCDX

function Main()

   local oWnd, oBrw, oBar

   USE Customer NEW SHARED VIA "DBFCDX"

   DEFINE WINDOW oWnd TITLE FWVERSION
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32

   @ 0, 0 XBROWSE oBrw OF oWnd ALIAS "Customer"  ;
      COLUMNS "First", "Last" ;
      FASTEDIT

   oBrw:nEditTypes   := EDIT_GET
   oBrw:lAutoSaves   := .t.

   oBrw:createFromCode()
   oWnd:oClient      := oBrw

   DEFINE BUTTON PROMPT "Add"    OF oBar ACTION oBrw:EditSource( .t. )
   DEFINE BUTTON PROMPT "Edit"   OF oBar ACTION oBrw:EditSource()
   DEFINE BUTTON PROMPT "Delte"  OF oBar ACTION oBrw:Delete()

   ACTIVATE WINDOW oWnd

return nil
 
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 45 guests