gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set fixed culmn width in NSTableVeiw?


From: Nicola Pero
Subject: Re: How to set fixed culmn width in NSTableVeiw?
Date: Tue, 5 Mar 2002 10:41:11 +0000 (GMT)

> > Is this correct ?
> 
> Not really, I over simplified the things. I'll try to be more precise :
> - as long as the tableview fits perfectly, the tableview is resized
> - as soon as the tableview doesn't fit anymore, the tableview isn't
>     resized anymore
> - as soon as the tableview fits the clipview again, the tableview is
>     resized again. When I say "fits the clipview again", it means even in
>     a transition state : when you resize the scrollview
>     from being too narrow to being too wide (or the other way around), it
>     (implicitly) passes thru a certain state where the tableview
>     exactly fits the clipview, so autoresizing is back at this time.
> 
> Although this description may seem very weird and unintuitive, it seems
> pretty natural when you play with it (I guess the guys at NeXT had a hard
> time finding this behaviour). There may be some drawbacks with this
> behaviour, but the user will easily size the column the way he/she wants
> and still takes full benefit of the autoresizing mechanism.

There are still drawbacks anyway it seems reasonable so I won't insist.
 

> > You call sizeToFit precisely because you don't know the
> > minimum width of the columns.
> 
> We already talked about this, and I believe we should create a method
> that has the behaviour you describe, however we should give it another
> name because sizeToFit: has a specific behaviour on OSX/OS42 and I
> believe we should maintain compatibility.

It's not just a name issue ... how can you build generic
autosizing/autolayout objects if they can't autosize the controls they
manage by calling sizeToFit ?

If all controls autosize using the same method (which happens to be
sizeToFit for all other controls), the autosizing object can autosize the
control regardless of its class by calling that method.

If each control has a different method to autosize itself, then the
autosizing objects need to call a different method for each contained
control depending on the class ... that spoils the whole framework.

(I'm particularly talking of a tableview outside a scrollview here).

=

So the only solution seems to be that we could invent a completely
different method, put that in NSControl, and implement it for all gui
objects in a separate category (calling sizeToFit in most cases but not
all).

Custom subclasses must then implement this method to have working
autosizing, and not sizeToFit.  Even if the NSControl implementation will
call sizeToFit so by implementing sizeToFit in most cases they should be
ok.  It should then be recommended to use this method instead of sizeToFit
to autosize gui objects.

I have this feeling that doing this basically means expelling autosizing
from the gui classes ... very sad.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]