TxBrowse - Edit

TxBrowse - Edit

Postby Davide » Wed Mar 11, 2009 1:48 am

Hello all,

when editing a cell and leaving it with the arrow keys, the new value is correctly stored.
Code: Select all  Expand view
oBrw:aCols[1]:bOnPostEdit   := {|o,x| aTemp[ oBrw:nArrayAt, 1 ] := x }

when leaving it by a mouse click on another cell, the old value is restored in that cell (like by pressing ESC)
I would like to save it however, like in a real spredsheet.
Tried with or without lFastEdit, same behaviour.

TIA
Davide
FWH 9.02 - xH 1.1 - Bcc 55
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Wed Mar 11, 2009 5:42 am

Hello Davide...

xBrowse dont have this feature but you can make that

if you want test first download example
in the example i did config only columns 1 & 2 but if you want all columns you can do

http://www.sitasoft.com/fivewin/test/testxbr2.rar

open xbrowse.prg

add new data in TXBrwColumn class
Code: Select all  Expand view

DATA lAutoSave AS LOGICAL INIT .f.


find METHOD CancelEdit() CLASS TXBrowse
inside this method find
Code: Select all  Expand view
     for nFor := 1 to nLen
         oCol := ::aCols[ nFor ]
         if oCol:oEditGet != nil
            oCol:oEditGet:VarPut( Eval( oCol:bEditValue ) )
            oCol:oEditGet:bValid = nil
            oCol:PostEdit()
         endif
         if oCol:oEditLbx != nil
            oCol:oEditLbx:End()
         endif
      next


replace with

Code: Select all  Expand view
     for nFor := 1 to nLen
         oCol := ::aCols[ nFor ]
         if oCol:oEditGet != nil
            oCol:oEditGet:VarPut( Eval( oCol:bEditValue ) )
            oCol:oEditGet:bValid = nil
            if oCol:lAutoSave             //new line
               oCol:oEditGet:Assign()  //new line
            endif                               //new line
            oCol:PostEdit()
         endif
         if oCol:oEditLbx != nil
            oCol:oEditLbx:End()
         endif
      next


it's all...

Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"

function TestMain()

   local oWnd
   local oBrw

   
   local aArray := {}
   
   DEFINE WINDOW oWnd TITLE "Testing Empty Array xBrowse"
   
 
   if empty( aArray )                          
      aArray := {{"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"}}    
   endif

   
   @ 0,0 XBROWSE oBrw OF oWnd ;
      COLUMNS {1,2,3,4} ;
      HEADERS {"uno","dos","tres","cuatro"} ;
      array aArray LINES CELL fastedit
   
   oBrw:aCols[ 1 ]:lAutoSave := .t.
   oBrw:aCols[ 2 ]:lAutoSave := .t.
   
   
   aeval( oBrw:aCols, { |oCols| oCols:nEditType := EDIT_GET } )
   
   oWnd:oClient := oBrw
   
   oBrw:createfromcode()
   
   activate window oWnd
   
return nil

 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TxBrowse - Edit

Postby James Bott » Wed Mar 11, 2009 5:49 am

Antonio,

>when leaving it by a mouse click on another cell, the old value is restored in that cell (like by pressing ESC). I would like to save it however, like in a real spredsheet.

This is the behavior every users expects. I suggest making is as the default behavior of TXBrowse. I don't think it will break any apps since users will be glad if it now works that way.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TxBrowse - Edit

Postby Davide » Wed Mar 11, 2009 11:26 pm

James Bott wrote:This is the behavior every users expects. I suggest making is as the default behavior of TXBrowse. I don't think it will break any apps since users will be glad if it now works that way.

I agree. Apart dinos like me, most of the customers doesn't use the keyboard so much and moves between the cells with the mouse, then they call asking why the program doesn't save the data they type.
I vote to make this the default behaviour too.
Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Wed Mar 11, 2009 11:30 pm

Hello Davide

do you test my change?

worked ok?
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TxBrowse - Edit

Postby Davide » Thu Mar 12, 2009 1:01 am

Dear Daniel,
Daniel Garcia-Gil wrote:do you test my change?

thank you for your help. Unfortunately I haven't yet had time to test it, but I'll do it surely.
Actually I'm busy on reapplying my custom changes to other classes. In fact I purchased the FTDN in December, but installed it only yesterday because each time I upgrade I have to redo that job.
That's why I hope Antonio will accept James's suggestion. The less custom classes I use, the simpler is for me upgrading FWH.

I'll test it asap, and I'll let you know.

Thanks again.
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: TxBrowse - Edit

Postby Antonio Linares » Tue Mar 17, 2009 9:29 pm

James,

Yes, we are going to include Daniel's changes in next FWH build :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TxBrowse - Edit

Postby Davide » Sat Mar 21, 2009 5:39 pm

Antonio,
Antonio Linares wrote:Yes, we are going to include Daniel's changes in next FWH build :-)

when exiting the last cell with the TAB key I receive:
MsgStop( "::bPastEof not defined","Fivewin: Class TXBrowse" )
I'm not willing to append data to the array. Could you please remove that message too ? (BTW, it's just something for the programmer, not the end user)
Thanks,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: TxBrowse - Edit

Postby nageswaragunupudi » Sat Mar 21, 2009 6:25 pm

With the above change, the contents are saved even when Eval( oCol:bEditValid ) is false.
Regards

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

Re: TxBrowse - Edit

Postby nageswaragunupudi » Sat Mar 21, 2009 6:44 pm

It is true that xbrowse behaves differently than excel in this regard.

I have the following suggestions for consideration of our friends here.

1. lAutosave can be a setting for the entire browse than for individual columns. Even better it is something like a class variable or a global setting. We like to offer consitant behaviour across the entire application or atleast within the same browse. It may not be desirable to have different columns in different browses behaving differently.

2. Save only if the oCol:bEditValid evaluates to true.

3. Save only when the user clicks on some other column in the same browse, but not otherwise. Half way through editing the user may go to some other window like a help window or see some other application or window for some information or scroll the browse up or down to refer to some information with a view to continue the edit. If xbrowse has to behave like excel, the edit has to remain the same edit poition when he comes back after he refers to other information / after other operation.

The danger with the present change is that if the user does anything ( referring to information in some help window or other application ) the partly edited value is saved. This is not what the user expects. He expects to continue and complete the edit when he comes back to the browse.

If we like to make this compatible with excel, we need to do it *safely* like excel. This may involve more work but desirable.
Regards

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

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Sat Mar 21, 2009 7:18 pm

nageswaragunupudi...

thank you... good suggestions...
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Sun Mar 22, 2009 4:24 am

Rao...

Thank You for all suggestions

1. lAutosave can be a setting for the entire browse than for individual columns. Even better it is something like a class variable or a global setting. We like to offer consitant behaviour across the entire application or atleast within the same browse. It may not be desirable to have different columns in different browses behaving differently.

i leave this change for individual column no entry browse.... for this way you have more control over browse ( programer level ).... But, if user prefer a global data, we 'll do change

2. Save only if the oCol:bEditValid evaluates to true.

yes... you have reason... this point is solved

3. Save only when the user clicks on some other column in the same browse, but not otherwise. Half way through editing the user may go to some other window like a help window or see some other application or window for some information or scroll the browse up or down to refer to some information with a view to continue the edit. If xbrowse has to behave like excel, the edit has to remain the same edit poition when he comes back after he refers to other information / after other operation.

This point is solved...
when user click over other control in same aplication the data is saved but when user click over other aplication the cell will continue in edition status...

this point have a limitation, the get do not got focus inmediatly, first you have to press any key (no esc)

this change will be added in the next build...

I would like talk with you for more suggestions/opinions
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TxBrowse - Edit

Postby nageswaragunupudi » Sun Mar 22, 2009 5:12 am

Nice.
Would you mind sharing your revised CancelEdit method ?
Regards

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

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Sun Mar 22, 2009 7:35 am

Rao..

i did so many change in various class

it was changed in CancelEdit Method...

Code: Select all  Expand view
     if ::lEditMode
      nLen := Len( ::aCols )
      for nFor := 1 to nLen
         oCol := ::aCols[ nFor ]
         if oCol:oEditGet != nil
            if oCol:nEditType < EDIT_DATE .and. !oCol:lAutoSave
               oCol:oEditGet:VarPut( Eval( oCol:bEditValue ) )
            elseif oCol:lAutoSave
               if oCol:oEditGet:lValid() .and. oCol:oEditGet:nLastKey != VK_ESCAPE
                  oCol:oEditGet:Assign()
               else
                  oCol:oEditGet:VarPut( Eval( oCol:bEditValue ) )
               endif
            endif
            oCol:oEditGet:bValid = nil
            oCol:PostEdit()
         endif
         if oCol:oEditLbx != nil
            oCol:oEditLbx:End()
         endif
      next

      ::lEditMode := .f.
   endif


Other changes should be available in the next FWH Build

Please check this sample, valid = only accept negative number
http://www.sitasoft.com/fivewin/test/test1.rar
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TxBrowse - Edit

Postby Daniel Garcia-Gil » Mon Mar 23, 2009 5:12 am

Davide wrote:Antonio,
Antonio Linares wrote:Yes, we are going to include Daniel's changes in next FWH build :-)

when exiting the last cell with the TAB key I receive:
MsgStop( "::bPastEof not defined","Fivewin: Class TXBrowse" )
I'm not willing to append data to the array. Could you please remove that message too ? (BTW, it's just something for the programmer, not the end user)
Thanks,
Davide


Hello Davide...
from december 2008 build (8.12) xbrowse have a new data lAutoAppend, default value = .t. if you want not append more row automaticly , set lAutoAppend := .f.
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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