Big problem with xbrowse and lFastEdit=.t.

Big problem with xbrowse and lFastEdit=.t.

Postby Marco Turco » Thu May 07, 2009 9: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: Select all  Expand view
#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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Big problem with xbrowse and lFastEdit=.t.

Postby nageswaragunupudi » Thu May 07, 2009 8:15 pm

Will you please try this fix ?
You will find the following code in method GoNextCtrl(hWnd) of TXBrpwse ( around line 4657 )
Code: Select all  Expand view
                    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: Select all  Expand view
                       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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Big problem with xbrowse and lFastEdit=.t.

Postby Marco Turco » Fri May 08, 2009 6: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Big problem with xbrowse and lFastEdit=.t.

Postby nageswaragunupudi » Fri May 08, 2009 11:44 am

I downloaded and tested
Please try with this fix.
Code: Select all  Expand view
              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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Big problem with xbrowse and lFastEdit=.t.

Postby Daniel Garcia-Gil » Fri May 08, 2009 4:45 pm

Hello...

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

Code: Select all  Expand view
                   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: Select all  Expand view
                    if ::lAutoAppend .or. ::nDataRows > ::nRowSel
                        if !( ::bPastEof == NIL .and. ::KeyNo() == ::nLen ) //line changed
                           ::Select( 0 )
                           ::GoDown()
                           ::Select( 1 )
                        endif
                     endif
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Big problem with xbrowse and lFastEdit=.t.

Postby Daniel Garcia-Gil » Fri May 08, 2009 7:27 pm

hello..

the Mr Rao's code work fine
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Big problem with xbrowse and lFastEdit=.t.

Postby Marco Turco » Sat May 09, 2009 7:20 am

Yes, all runs fine with this modified code now.

Thanks a lot.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Giovany Vecchi, Google [Bot] and 72 guests