Loading dynamically a presenter as a ContainerView.

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

Loading dynamically a presenter as a ContainerView.

Dominique Dartois-2
Hello.
I use a card container with cards (ContainerViews). I want to create a card
in the view composer as a Presenter and then load it as needed in the card
container with the appropriate data.
I try something like:
myCardContainerPresenter view addSubView: myPresenter view.

but the debugger tells me myPresenter view is a DeafObject.

I can't figure how to code this correctly.

Thank you.

----
Dominique Dartois


Reply | Threaded
Open this post in threaded view
|

Re: Loading dynamically a presenter as a ContainerView.

Chris Uppal-3
Dominique,

> I use a card container with cards (ContainerViews). I want to create a
> card in the view composer as a Presenter and then load it as needed in
> the card container with the appropriate data.

Try this workspace example:

    "create the tabbed container"
    tabs := Presenter show: 'Card container'.

    "add one tab"
    list := ListPresenter create: 'Enhanced list view' in: tabs.
    list view arrangement: 'List tab'.

    "and another"
    text := TextPresenter createIn: tabs.
    text view arrangement: 'Text tab'.

    "remove first tab"
    tabs remove: list.

In real code you might also want to specify the model for the new tab, in which
case you'd use one of the other flavours of Presenter class>>#create:xxx

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Loading dynamically a presenter as a ContainerView.

Dominique Dartois-2
Thank you very much Chris for making me discover the Presenter
class>>#createIn:xxx family.


> In real code you might also want to specify the model for the new tab, in
> which
> case you'd use one of the other flavours of Presenter class>>#create:xxx

Yes, I've used something like :
text := TextPresenter createIn: tabs on: myModel.

Thanks again.

----
Dominique Dartois