Autosizing the column widths of a grid just once ?

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
    self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column widths he wants, so I use
    self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than minimal needed.

Is this a bug, or am I forgetting something ?

thanks,
Stef Mientki

Stef Mientki wrote:

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
    self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column
widths he wants, so I use
    self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than
minimal needed.

Is this a bug, or am I forgetting something ?

Have you checked grid.SetColMinimalWidth() and
grid.SetColMinimalAcceptableWidth()?

I am not sure what the default values are, but they are greater than zero,
and you cannot size the columns to anything lower.

Therefore you may need to call the above methods with a value of zero (or
whatever you want the minimum to be).

HTH

Frank Millman

Frank Millman wrote:

Stef Mientki wrote:
  

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
    self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column
widths he wants, so I use
    self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than
minimal needed.

Is this a bug, or am I forgetting something ?

Have you checked grid.SetColMinimalWidth() and
grid.SetColMinimalAcceptableWidth()?

I am not sure what the default values are, but they are greater than zero,
and you cannot size the columns to anything lower.

Therefore you may need to call the above methods with a value of zero (or
whatever you want the minimum to be).

thanks frank, but I doubt that's the reason.
I tried this:
    self.Grid.AutoSizeColumns ( True )
    self.Grid.ForceRefresh ()

    self.Grid.SetColMinimalAcceptableWidth ( 10 )
    self.Grid.SetColMinimalWidth (0, 10)
    self.Grid.SetColMinimalWidth (1, 10)
    self.Grid.AutoSizeColumns ( False )
    self.Grid.SetColMinimalAcceptableWidth ( 10 )
    self.Grid.SetColMinimalWidth (0, 10)
    self.Grid.SetColMinimalWidth (1, 10)
but still I can't resize the columns smaller that needed by the textes.

cheers,
Stef

···

HTH

Frank Millman

>

Stef,

···

On Jul 6, 4:33 am, Stef Mientki <stef.mien...@gmail.com> wrote:

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column
widths he wants, so I use
self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than
minimal needed.

Is this a bug, or am I forgetting something ?

thanks,
Stef Mientki

It looks like my columns resize down to one characters across at
default font size. That makes the columns mostly useless when it's
that width since I can't fully see both characters.

How small does a user need to go?

- Mike

hi Mike,

Mike Driscoll wrote:

Stef,

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
    self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column
widths he wants, so I use
    self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than
minimal needed.

Is this a bug, or am I forgetting something ?

thanks,
Stef Mientki
    
It looks like my columns resize down to one characters across at
default font size.

Yes I can do that too,
but not after I've once used

  self.Grid.AutoSizeColumns ( True )

there seems to be no way back.

cheers,
Stef

···

On Jul 6, 4:33 am, Stef Mientki <stef.mien...@gmail.com> wrote:
That makes the columns mostly useless when it's
that width since I can't fully see both characters.

How small does a user need to go?

- Mike
>

Hi Stef,

···

On Jul 6, 9:24 am, Stef Mientki <stef.mien...@gmail.com> wrote:

hi Mike,

Mike Driscoll wrote:
> Stef,

> On Jul 6, 4:33 am, Stef Mientki <stef.mien...@gmail.com> wrote:

>> hello,

>> I'm using a gridlib.Grid
>> under wx '2.8.7.1 (msw-unicode)'

>> Now initial I want to set a correct minimal width for each col,
>> so this works:
>> self.Grid.AutoSizeColumns ( True )

>> After the table is initialized, the user has to decide what column
>> widths he wants, so I use
>> self.Grid.AutoSizeColumns ( False )

>> But the user is still not able to make the column width smaller than
>> minimal needed.

>> Is this a bug, or am I forgetting something ?

>> thanks,
>> Stef Mientki

> It looks like my columns resize down to one characters across at
> default font size.

Yes I can do that too,
but not after I've once used

    self\.Grid\.AutoSizeColumns \( True \)

there seems to be no way back.

cheers,
Stef

I just tried it on my machine and it does behave the way you reported.
That is pretty annoying. You may be forced into calculating the widths
yourself and use the grid's methods to set the correct column width
size. Robin may know something about this too...

Mike

Stef Mientki wrote:

hi Mike,

Mike Driscoll wrote:

Stef,

hello,

I'm using a gridlib.Grid
under wx '2.8.7.1 (msw-unicode)'

Now initial I want to set a correct minimal width for each col,
so this works:
    self.Grid.AutoSizeColumns ( True )

After the table is initialized, the user has to decide what column
widths he wants, so I use
    self.Grid.AutoSizeColumns ( False )

But the user is still not able to make the column width smaller than
minimal needed.

Is this a bug, or am I forgetting something ?

thanks,
Stef Mientki
    

It looks like my columns resize down to one characters across at
default font size.

Yes I can do that too,
but not after I've once used

  self.Grid.AutoSizeColumns ( True )

there seems to be no way back.

When you pass True to the AutoSizeColumns methods then it is the same as if you had called AutoSizeColumns(False) followed by SetColMinimalWidth(col, GetColSize(col)) for every column. So to undo that setting of the minimal width for every column you need to call SetColMinimalWidth yourself with some other width (greater than GetColMinimalAcceptableWidth).

···

On Jul 6, 4:33 am, Stef Mientki <stef.mien...@gmail.com> wrote:

--
Robin Dunn
Software Craftsman

(greater than GetColMinimalAcceptableWidth).

thanks Robbin,
that was the trick.

cheers,
Stef