From: Amilcar A. Camargo on
Hi Geoff,

On Sat, 9 Jan 2010 12:18:09 -0800 (PST), Geoff Chambers <gchambers02(a)msn.com>
wrote:

>I have a bBrowser set up in a window so the browser fills the window.
>I have a column set with AutoWodthColumn, so the browser fills the
>entire window. I would like to limit the AutoWidthColumn to say 500
>using oColumn:WidthMax, but I still want the browser to fill the
>window and setting this property prevents that. I gues I would like a
>second column to take over and automatically adjust.
>
>Is this possible?

You can use the following method. Note that it has being assigned to a window
but you can rewrite it for use directly in a bBrowser class. Also note that it
keeps the size of the first column. You have to adjust it to keep the size of
some other column.

[BEGIN PASTE]
METHOD ResizeColumns() CLASS MyWindow
// Readjust columns sizes to fill entire data area
// (from second column on)
//
// Author.......: Amilcar Camargo -- � 2000 - 2006
// Date.........: 14-Dic-2006
// Modified.....:
LOCAL oData AS BoundingBox
LOCAL dwLeft AS DWORD // left col
LOCAL dwData AS DWORD // every other column
LOCAL dwCol AS DWORD // # of cols
LOCAL dwTot AS DWORD // talling
LOCAL oCol AS bDataColumn
LOCAL i AS DWORD

// process only if # of columns > 1
dwCol := SELF:oDCBrowser:ColumnOpenCount
IF dwCol > 1

// First, get dataarea size
oData := SELF:oDCBrowser:DataArea

// Now, get left column width
oCol := SELF:oDCBrowser:GetOpenColumn( 1 )
dwLeft := oCol:Width

// Calculate how much must be the others
dwData := ( oData:Width - dwLeft ) / ( dwCol - 1 )

// Ok, now, set each size
dwTot := 0
FOR i := 2 UPTO dwCol - 1
oCol := SELF:oDCBrowser:GetOpenColumn( i )
oCol:Width := dwData
dwTot += dwData
NEXT i
// last one should get the rest
oCol := SELF:oDCBrowser:GetOpenColumn( dwCol )
oCol:Width := oData:Width - dwLeft - dwTot

// Redraw
SELF:oDCBrowser:SuspendUpdate()
SELF:oDCBrowser:Recalculate()
SELF:oDCBrowser:RestoreUpdate()
SELF:oDCBrowser:Redraw()

ENDIF

RETURN NIL
[END PASTE]

HTH
Amilcar A. Camargo F.
Guatemala, C. A.
From: Geoff Chambers on
It works great, I'll keep you advised if I run into any problems. I
do
have a couple of Group columns, I'll try it on them and see what
happens.

One thing I noticed though, I programed all of my BuildBrowsers on
Self:bBrowser from your class GCSbBrowser, I had to change the code
to
Self:oDCBrowser since Self:bBrowser inherits from GCSBrowser.




From: Geoff Chambers on
On Jan 10, 4:04 pm, Geoff Chambers <gchamber...(a)msn.com> wrote:
> It works great, I'll keep you advised if I run into any problems. I
> do
> have a couple of Group columns, I'll try it on them and see what
> happens.
>
> One thing I noticed though, I programed all of my BuildBrowsers on
> Self:bBrowser from your class GCSbBrowser, I had to change the code
> to
> Self:oDCBrowser since Self:bBrowser inherits from GCSBrowser.

Geoff:

As as a follow up I used it with #EXPRESSION and Groupd columns and
have not seen any ill effects with either.
From: Geoff Schaller on
Yes.

You'll need to fix that little bit of inheritance or just merge the two
classes.

Geoff


>
> It works great, I'll keep you advised if I run into any problems. I do
> have a couple of Group columns, I'll try it on them and see what
> happens.
>
> One thing I noticed though, I programed all of my BuildBrowsers on
> Self:bBrowser from your class GCSbBrowser, I had to change the code to
> Self:oDCBrowser since Self:bBrowser inherits from GCSBrowser.

From: Geoff Schaller on
Amilcar,

You don't need to do this - such behaviour is already automatic in
bBrowser:

obBrowser:AutoWidthColumn := #MyColumn.

By default it is always the last column but you can have any column you
like. You code is redundant. What Geoff Chambers was after was to
specify multiple auto width columns, each taking up the slack once a
prior one had reached a maximum. I know why he wants this. In some
browsers one column could go hugely wide when it would have been nice to
spread the width to other columns too.

Geoff


"Amilcar A. Camargo" <amilcarcamargo(a)gmail.com> wrote in message
news:nn2kk55qdjffjh9ukmee7kc3jcs6cq6d2h(a)4ax.com:

> Hi Geoff,
>
> On Sat, 9 Jan 2010 12:18:09 -0800 (PST), Geoff Chambers <gchambers02(a)msn.com>
> wrote:
>
>
> >I have a bBrowser set up in a window so the browser fills the window.
> >I have a column set with AutoWodthColumn, so the browser fills the
> >entire window. I would like to limit the AutoWidthColumn to say 500
> >using oColumn:WidthMax, but I still want the browser to fill the
> >window and setting this property prevents that. I gues I would like a
> >second column to take over and automatically adjust.
> >
> >Is this possible?
>
>
> You can use the following method. Note that it has being assigned to a window
> but you can rewrite it for use directly in a bBrowser class. Also note that it
> keeps the size of the first column. You have to adjust it to keep the size of
> some other column.
>