caption on a ListPresenter?

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

caption on a ListPresenter?

jWarrior
if i evaluate this code:

x := OrderedCollection new.
1 to: 10 do: [:e | x add: e printString].
ListPresenter showOn: x

i get a listPresenter with 10 lines of numbers. however, the
title/caption says 'a ListPresenter'. how can i change that?

i just want a listpresenter with -my- title in it. i don't want to gin
up a whole new view for this simple task.

thanks.

Donald
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: caption on a ListPresenter?

Bill Schwab
Donald,

> if i evaluate this code:
>
> x := OrderedCollection new.
> 1 to: 10 do: [:e | x add: e printString].
> ListPresenter showOn: x
>
> i get a listPresenter with 10 lines of numbers. however, the
> title/caption says 'a ListPresenter'. how can i change that?
>
> i just want a listpresenter with -my- title in it. i don't want to gin
> up a whole new view for this simple task.

ListPresenters use list/combo box controls that don't have a caption.
#showOn: is creating a shell to wrap the list box to make it easy to
move/resize/close it, and probably to prevent it from being gc'd.  If that's
what you want, and simply want to change its caption, then you can send (to
the list presenter)

    topShell caption:'Try this'

If you want to caption a list presenter that is a sub-presenter of a
composite, then it's a little more trouble because you have to provide a
peer control to hold the caption.  If you have only a few of them, you can
use either group boxes or static text controls to hold the captions.  I have
one app that uses lots of captioned lists and defines a composite presenter
for the purpose; other view resources embed them as reference views.

More recently, I've created what I think (well, hope anyway<g>) is a
composite presenter that works as a value presenter - the tricky part was to
identify the various ways that the models and the presenters can initiate
changes.  It sounds like D5 will make this kind of thing a lot easier to do
because OA has moved the composite behavior up to Presenter, allowing any
presenter to be a composite.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: caption on a ListPresenter?

Ian Bartholomew-5
In reply to this post by jWarrior
Donald,

> i just want a listpresenter with -my- title in it. i don't want to gin
> up a whole new view for this simple task.

x := OrderedCollection new.
1 to: 10 do: [:e | x add: e printString].
lp := ListPresenter showOn: x.
lp topShell caption: 'Hello, world'

When you display a resource that is not a Shell then Dolphin automatically
wraps it in one for you. It is the caption of _this_ Shell presenter
(obtained by sending #topShell to your presenter) that you want to change.

FWIW, you can also change the size of the Shell at the same time, to
something more reasonable

lp topShell
    extent: 200@400;
    caption: 'Hello, world'

Ian