FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Big problem with xbrowse and lFastEdit=.t.
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Big problem with xbrowse and lFastEdit=.t.
Posted: Thu May 07, 2009 09:23 AM
Hi all,
there is a problem with the xbrowse (fwh april 2009) using lFastEdit=.t.

With a previous xbrowse version I used lFastedit=.t. and oBrw:GoDown to go to the next cell.

Now, using lFastEdit=.t. the control automatically go to the next cell but if the array is more lenght then the xbrowse window then when I am on the last visible cell, pressing enter the control remain on that cell instead to go to the next cell scrolling the browse.

This is a self-contained sample that show the problem.
Try to change the numeric values and press enter each time. You will see that at the end of the xbrowse windows the fastedit terminate always on the last visible cell instead to scroll the xbrowse and go to the next cell.

Any solution ?

Thanks in advance.


Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oDlg, oBrw, aArray

*    set century off
    set epoch to 1920

    aArray:={}
    aadd(aArray,{"Marc",10.2})
    aadd(aArray,{"Luca",6.5})
    aadd(aArray,{"James",11.3})
    aadd(aArray,{"Christine",1.3})
    aadd(aArray,{"Melanie",15.3})
    aadd(aArray,{"Robert",14.3})
    aadd(aArray,{"Jimmy",13.3})
    aadd(aArray,{"Enrico",10.3})
    aadd(aArray,{"Mario",12.3})
    aadd(aArray,{"Pinco",13.3})
    aadd(aArray,{"Eric",14.3})

    DEFINE DIALOG oDlg SIZE 300, 200

    @0,0 XBROWSE oBrw OF oDlg ARRAY aArray AUTOCOLS

    oBrw:aCols[2]:cEditPicture := "@E 999.99"
    oBrw:aCols[2]:nEditType    := 1
    oBrw:aCols[2]:bOnPostEdit  := {|o,x| nLastCell:=oBrw:nArrayAt,aArray[oBrw:nArrayAt,2]:=x}
    oBrw:lFastEdit:=.t.
    oBrw:CreateFromCode()
      
   ACTIVATE DIALOG oDlg CENTER

return nil
Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Thu May 07, 2009 08:15 PM
Will you please try this fix ?
You will find the following code in method GoNextCtrl(hWnd) of TXBrpwse ( around line 4657 )
Code (fw): Select all Collapse
                     if ::lAutoAppend .or. ::nDataRows > ::nRowSel
                        if !( ::bPastEof == NIL .and. ::nDataRows = ::nRowSel )
                           ::Select( 0 )
                           ::GoDown()
                           ::Select( 1 )
                        endif
                     endif

Please substitute the above lines of code with the following block of code
Code (fw): Select all Collapse
                        if ( ::nRowSel < ::nDataRows ) .or. ;
                           ( ::lAutoAppend .and. ::bPastEof != nil )
                           ::Select( 0 )
                           ::GoDown()
                           ::Select( 1 )
                        endif

I have tested and the old behaviour is restored with this change.
Kindly try and give your feed back.
Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Fri May 08, 2009 06:48 AM

Hi,
thank you for your reply,
unfortunately the problem still remain.

I enclosed the executable, the prg sample and the modified xbrowse.prg

Any ideas ?

Thanks in advance.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Fri May 08, 2009 11:44 AM
I downloaded and tested
Please try with this fix.
Code (fw): Select all Collapse
               CASE ::nMoveType == MOVE_FAST_RIGHT
                  nNextPos    := 0
                  if ::nColSel < Len( ::aDisplay )
                     nNextPos := AScan( ::aDisplay, { |i| ::aCols[ i ]:nEditType > 0 }, ::nColSel + 1 )
                  endif
                  if nNextPos > 0
                     if ::IsDisplayPosVisible( nNextPos, .t. )
                        ::nColSel   := nNextPos
                        if ::FullPaint()
                           ::Super:Refresh( .t. ) //::Paint()
                        else
                           ::DrawLine( .t. )
                        endif
                     else
                        for n := ::nColSel + 1 to nNextPos
                           ::GoRight()
                        next n
                     endif
                  else
                     ::GoLeftMost()
                     nNextPos := AScan( ::aDisplay, { |i| ::aCols[ i ]:nEditType > 0 } )
                     if nNextPos > 1
                        if ::IsDisplayPosVisible( nNextPos, .t. )
                           ::nColSel   := nNextPos
                           ::DrawLine( .t. )
                        else
                           for n := 2 to nNextPos
                              ::GoRight()
                           next
                        endif
                     endif

                     ::Select( 0 )
                     ::GoDown()
                     ::Select( 1 )

                  endif

If you can please contact me by my email nageswaragunupudi@gmail.com, I shall send you the modified sources and exe
Regards



G. N. Rao.

Hyderabad, India
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Fri May 08, 2009 04:45 PM
Hello...

This other posible solutions... we need maintain sames features

Code (fw): Select all Collapse
                    if ::lAutoAppend .or. ::nDataRows > ::nRowSel
                        if !( ::bPastEof == NIL .and. ::nDataRows = ::nRowSel ) //change this for... see bellow
                           ::Select( 0 )
                           ::GoDown()
                           ::Select( 1 )
                        endif
                     endif


Line Changed
Code (fw): Select all Collapse
                     if ::lAutoAppend .or. ::nDataRows > ::nRowSel
                        if !( ::bPastEof == NIL .and. ::KeyNo() == ::nLen ) //line changed
                           ::Select( 0 )
                           ::GoDown()
                           ::Select( 1 )
                        endif
                     endif
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Fri May 08, 2009 07:27 PM

hello..

the Mr Rao's code work fine

Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Big problem with xbrowse and lFastEdit=.t.
Posted: Sat May 09, 2009 07:20 AM

Yes, all runs fine with this modified code now.

Thanks a lot.

Best Regards,



Marco Turco

SOFTWARE XP LLP

Continue the discussion