ListViewColumn<<width: should not error, if no parent?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ListViewColumn<<width: should not error, if no parent?

Christopher J. Demers
If the width of a ListViewColumn is set via ListViewColumn<<width:  and
there is no parent there is an error.  I see that isAutoResize: and update
have a guard against this error.  I wonder if this check should be extended
to the width: method?  Interestingly there is a constructer method
ListViewColumn class<<text:width: that would never work unless width: could
handle a nil parent.

I happen to be working on some code that will let users customize what
columns are visible in ListViews.  I would love to be able to use a
collection of preconfigured ListViewColumn's to let the user select which
ones they want to use.  Currently I either have to use my own object to hold
the complete column description, or use basicWidth:.  Actually I suppose I
could also temporarily make parent a DeafObject.  However all this is a bit
more convoluted than I think it has to be.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: ListViewColumn<<width: should not error, if no parent?

Chris Uppal-3
Christopher J. Demers wrote:

> If the width of a ListViewColumn is set via ListViewColumn<<width:  and
> there is no parent there is an error.

I believe that this is the problem that has given me walkbacks in the VC a few
times.  I ddn't have time to investigate when it happened but, IIRC, it tended
to go bang when I was cut-n-pasting columns.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: ListViewColumn<<width: should not error, if no parent?

Blair McGlashan
In reply to this post by Christopher J. Demers
"Christopher J. Demers" <[hidden email]> wrote in
message news:br8kq3$j47l$[hidden email]...
> If the width of a ListViewColumn is set via ListViewColumn<<width:  and
> there is no parent there is an error.  I see that isAutoResize: and update
> have a guard against this error.  I wonder if this check should be
extended
> to the width: method?  Interestingly there is a constructer method
> ListViewColumn class<<text:width: that would never work unless width:
could
> handle a nil parent.
>...

Thanks Chris, recorded as #1452.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: ListViewColumn<<width: should not error, if no parent?

Christopher J. Demers
"Blair McGlashan" <[hidden email]> wrote in message
news:br9tf9$v4pv$[hidden email]...
>
> "Christopher J. Demers" <[hidden email]> wrote in
> message news:br8kq3$j47l$[hidden email]...
> > If the width of a ListViewColumn is set via ListViewColumn<<width:  and
> > there is no parent there is an error.  I see that isAutoResize: and
update
> > have a guard against this error.  I wonder if this check should be
> extended
> > to the width: method?  Interestingly there is a constructer method
> > ListViewColumn class<<text:width: that would never work unless width:
> could
> > handle a nil parent.
> >...
>
> Thanks Chris, recorded as #1452.

On a related note, I notice that if I add columns to a list view the
autoResize column does not resize.  I have to manually send the layout
message.  See the example bellow.  Is this by design?

======
lv := ListView show.
lvc := ListViewColumn text: 'AutoResizeable'.
lv addColumn: lvc.
lvc isAutoResize: true.
lvc := ListViewColumn text: 'Column 2'.
lv addColumn: lvc.
"Stop evaluating here.  Notice the scroll bar. Either resize the window, or
run the line bellow."
lv layout.
======

Chris


Reply | Threaded
Open this post in threaded view
|

Re: ListViewColumn<<width: should not error, if no parent?

Blair McGlashan
"Christopher J. Demers" <[hidden email]> wrote in
message news:brbesi$1ibb7$[hidden email]...
> "Blair McGlashan" <[hidden email]> wrote in message
> news:br9tf9$v4pv$[hidden email]...
> >
> > "Christopher J. Demers" <[hidden email]> wrote in
> > message news:br8kq3$j47l$[hidden email]...
> > > If the width of a ListViewColumn is set via ListViewColumn<<width:
and

> > > there is no parent there is an error.  I see that isAutoResize: and
> update
> > > have a guard against this error.  I wonder if this check should be
> > extended
> > > to the width: method?  Interestingly there is a constructer method
> > > ListViewColumn class<<text:width: that would never work unless width:
> > could
> > > handle a nil parent.
> > >...
> >
> > Thanks Chris, recorded as #1452.
>
> On a related note, I notice that if I add columns to a list view the
> autoResize column does not resize.  I have to manually send the layout
> message.  See the example bellow.  Is this by design?

No, I think its a minor bug (#1456). Thanks Chris.

Regards

Blair