TWBrowse GoLeft() [Solved]

TWBrowse GoLeft() [Solved]

Postby Enrico Maria Giordano » Fri Mar 09, 2007 8:55 am

This is the sample:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw

    USE TEST

    DEFINE WINDOW oWnd

    @ 0, 0 LISTBOX oBrw FIELDS

    oBrw:lCellStyle = .T.

    oWnd:oClient = oBrw

    ACTIVATE WINDOW oWnd;
             MAXIMIZED

    CLOSE

    RETURN NIL


Try to:

- move the hilight to a column near the right side of the browse

- restore the window (click the button near the right-top X)

- move the now invisible hilight to the left

You should get an error.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Fri Mar 09, 2007 5:56 pm

Enrico,

I confirm it with Aug 2006 build. I'm surprized nobody has reported it sooner.

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

Postby Antonio Linares » Fri Mar 09, 2007 7:17 pm

This seems as a possible fix:
Code: Select all  Expand view
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TWBrowse

   local nTotalSize := 0

   ::nRowPos = Min( ::nRowPos, Max( ::nRowCount(), 1 ) )
   ::nColAct = Min( ::nColAct, AScan( ::GetColSizes(),;
                                      { | nSize | nTotalSize += nSize,;
                                      nWidth < nTotalSize }, ::nColPos ) )

return Super:ReSize( nSizeType, nWidth, nHeight )

and in function wbrwline():
Code: Select all  Expand view
   ...
   nColPos = Max( nColPos, 1 )  // new!

   for n := nColPos to Len( aValues )
      nLeft   = nColStart + 1
      nRight  = Min( nColStart := ( nLeft + aColSizes[ n ] - 1 ), nWidth )
      if nLeft > nWidth
         exit
      endif
      if n >= Len( aValues ) // changed!
         nRight = nWidth
      endif
      ...

though is this the desirable behavior ?
regards, saludos

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

Postby Enrico Maria Giordano » Fri Mar 09, 2007 11:09 pm

Antonio Linares wrote:This seems as a possible fix:


Thank you.

Antonio Linares wrote:though is this the desirable behavior ?


Yes, it is similar to the vertical resize behavior. But there is one more problem: the horizontal scrollbar is not correctly updated. Can you fix that too?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sat Mar 10, 2007 7:04 am

Enrico,

Horizontal scrollbar updated:
Code: Select all  Expand view
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TWBrowse

   local nTotalSize := 0

   ::nRowPos = Min( ::nRowPos, Max( ::nRowCount(), 1 ) )
   ::nColAct = Min( ::nColAct, AScan( ::GetColSizes(),;
                                      { | nSize | nTotalSize += nSize,;
                                      nWidth < nTotalSize }, ::nColPos ) )
   if ::oHScroll != nil
      ::oHScroll:SetPos( ::nColAct )
   endif

return Super:ReSize( nSizeType, nWidth, nHeight )
regards, saludos

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

Postby Enrico Maria Giordano » Sat Mar 10, 2007 8:29 am

Perfect for me, thank you!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Mon Mar 12, 2007 5:53 pm

Unfortunately there is still a bug:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw

    DBCREATE( "BUGTEST", { { "TEST1", "C", 10, 0 },;
                           { "TEST2", "C", 10, 0 } } )

    USE BUGTEST

    APPEND BLANK

    DEFINE WINDOW oWnd

    @ 0, 0 LISTBOX oBrw FIELDS

    oBrw:lCellStyle = .T.

    oWnd:oClient = oBrw

    ACTIVATE WINDOW oWnd;
             MAXIMIZED

    CLOSE

    RETURN NIL


No cell is selected.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Mar 12, 2007 9:04 pm

Enrico,

It is a side effect of the latest change. This seems to fix it:
Code: Select all  Expand view
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TWBrowse

   local nTotalSize := 0

   ::nRowPos = Min( ::nRowPos, Max( ::nRowCount(), 1 ) )
   ::nColAct = Min( ::nColAct, AScan( ::GetColSizes(),;
                                      { | nSize | nTotalSize += nSize,;
                                      nWidth < nTotalSize }, ::nColPos ) )
   ::nColAct = Max( ::nColAct, 1 )
                                     
   if ::oHScroll != nil
      ::oHScroll:SetPos( ::nColAct )
   endif

return Super:ReSize( nSizeType, nWidth, nHeight )
regards, saludos

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

Postby Enrico Maria Giordano » Mon Mar 12, 2007 9:50 pm

Thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Wed Mar 14, 2007 11:25 am

Sorry, one more bug:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw

    DBCREATE( "BUGTEST", { { "TEST1", "C", 10, 0 },;
                           { "TEST2", "C", 10, 0 } } )

    USE BUGTEST

    APPEND BLANK

    DEFINE WINDOW oWnd

    @ 0, 0 LISTBOX oBrw FIELDS

    oBrw:lCellStyle = .T.

    oWnd:oClient = oBrw

    ACTIVATE WINDOW oWnd;
             MAXIMIZED

    CLOSE

    RETURN NIL


Select the second column and the resize the window: the first column will be selected back.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Sat Jul 26, 2008 10:38 am

Any news?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sun Jul 27, 2008 5:51 am

Enrico,

Fixed. This code seems the right one:
Code: Select all  Expand view
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TWBrowse

   local n, nTotalSize := 0, aSizes := ::GetColSizes()

   ::nRowPos = Min( ::nRowPos, Max( ::nRowCount(), 1 ) )
   
   n = Max( ::nColPos, 1 )
   while nTotalSize < nWidth .and. n <= Len( aSizes )
      nTotalSize += aSizes[ n++ ]
   end
   ::nColAct = Min( --n, ::nColAct )
                                     
   if ::oHScroll != nil
      ::oHScroll:SetPos( ::nColAct )
   endif

return Super:ReSize( nSizeType, nWidth, nHeight )

Please modify your example as follows and shrink the window and you will see how the selected cell is changed to the last visible one:
Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw

    DBCREATE( "BUGTEST", { { "TEST1", "C", 10, 0 },;
                           { "TEST2", "C", 10, 0 },;
                           { "TEST3", "C", 10, 0 },;
                           { "TEST4", "C", 10, 0 } } )

    USE BUGTEST

    APPEND BLANK

    DEFINE WINDOW oWnd

    @ 0, 0 LISTBOX oBrw FIELDS

    oBrw:lCellStyle = .T.

    oWnd:oClient = oBrw

    ACTIVATE WINDOW oWnd
           

    CLOSE

    RETURN NIL
regards, saludos

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

Postby Enrico Maria Giordano » Sun Jul 27, 2008 1:49 pm

Many thanks! :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 5 guests