xBrowse MoveCol() and nFreeze on FWH9.11

xBrowse MoveCol() and nFreeze on FWH9.11

Postby fraxzi » Tue Nov 24, 2009 1:08 am

Hello all,

Just a tip:

Using FWH9.11
If you use :MoveCol() method of xBrowse and :nFreeze with value... the order should be:

Code: Select all  Expand view

                             //this works perfectly with FWH9.11
With Object oBrw
        ...
        :MoveCol( nFrom, nTo)
        :nFreeze := 2
        ...
End
 


The reason why I post this:
I was using FWH9.10 and the order was:

Code: Select all  Expand view

                             //this doesn't work with FWH9.11
With Object oBrw
        ...
        :nFreeze := 2
        :MoveCol( nFrom, nTo)
        ...
End
 



:lol:


Regards,
Fraxzi
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: xBrowse MoveCol() and nFreeze on FWH9.11

Postby Antonio Linares » Fri Nov 27, 2009 8:22 am

Frances,

we are going to review it,

many thanks for your feedback :-)
regards, saludos

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

Re: xBrowse MoveCol() and nFreeze on FWH9.11

Postby Antonio Linares » Sat Nov 28, 2009 10:00 am

Frances,

Purpose of freezing some columns is that they always remain on the left during the entire runtime of the browse.

XBrowse allows the user to rearrange the columns by dragging column headers. If the user drags un-freezed columns into the freezed area or drags freezed columns outside the freezed area, the very intention of the programmer is defeated.

Till version 9.10, the only option available to the programmer to protect the freeze is by setting oBrw:lAllowColSwapping to false, thereby denying the user the facility to rearrange columns. But with this approach the user can not rearrange any columns, even within the unfreezed area or within the freezed area, which is not against the intentions of the programmer.

The change made in the MoveCol() method of version 9.11 is that the user can still rearrange the columns by dragging, but he can not drag an un-freezed column into the freezed area or a freezed column out of the freezed area. But he can rearrange columns within the un-freezed area or within the freezed area. This does not defeat the purpose of freezing and at the same time allows the user maximum possible flexibility to rearrange the columns without disturbing the freeze.

Though even while programming setting the freeze after rearranging the columns is a better idea, it is appreciated that this restriction in the MoveCol() method should be applicable to the user at runtime but not
necessarily to the programmer while writing the code. This is implemented in verson 9.12. With this change, the programmer can still use MoveCol() method to rearrange columns in his program without any restriction and at the same time the user can not disturb the freeze at runtime.

To implement this change in version 9.11, the following lines may be changed:

Line 4968: METHOD MoveCol( xFrom, xTo, lRefresh, lUser ) CLASS TXBrowse
Line 4973: DEFAULT lRefresh := .t., lUser := .f.
Line 4986: if lUser .and. ! Empty( ::nFreeze )
Line 9079: ::oBrw:MoveCol( Self, oCol, .t., .t. )

In addition to MoveCol() method, two other methods are available to the
programmer (not to the user) for rearranging the columns, without any
restrictions.

1. SwapCol( xcol1, xCol2, lRefresh )
This method swaps two columns without disturbing the position of other columns.

Difference between MoveCol and SwapCol is explained below:

As an example, in a browse having ten columns, after MoveCol( 7, 3 ), the resultant order of columns is :
1, 2, 7, 3, 4, 5, 6, 8, 9, 10

After SwapCol( 7, 3 )
1, 2, 7, 4, 5, 6, 3, 8, 9, 10

2. ReArrangeCols( aSequence, lRetainRest )

aSequence is an array of column creation numbers or column headers.

This method rearranges all columns in the revised sequence. If lRetainRest( true by default ) is true, columns not included in the aSequence are retained at the end in the original sequence else these remaining columns
are deleted.
regards, saludos

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

Re: xBrowse MoveCol() and nFreeze on FWH9.11

Postby fraxzi » Tue Dec 01, 2009 12:20 am

Dear Mr. Antonio,

Thank you for the detailed explanation. Switching a line of code from one to another doesn't hurt.


Thank you so much for the greatest support.

Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

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