Add a preseter in a dynamic way

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

Add a preseter in a dynamic way

Bruno Brasesco
Hi all,

I have a complex Presenter. Inside this Presenter I have a
CompositePresenter.

I want to add in dynamic way (depending on user menu selection) another
complex Presenter inside my CompositePresenter.

I try:
Example (i try this):

ClassBrowserShell createIn: myCompositePresenter. but do not work.
ListPresenter createIn: myCompositePresenter. this works ok.

Is there any way to do this ?


Best Regards
Bruno Brasesco.


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Bill Schwab-2
Bruno,

> I have a complex Presenter. Inside this Presenter I have a
> CompositePresenter.
>
> I want to add in dynamic way (depending on user menu selection) another
> complex Presenter inside my CompositePresenter.

The base system does this kind of thing in a couple of places, including the
published aspect inspector.  You can also try the PaneHolders package on my
web site; start with PaneHolder itself.

Have a good one,

Bill

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


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Bruno Brasesco
In reply to this post by Bruno Brasesco
Hi all,

Is Theres any message in Presenter class like:

showIn: aCompositePresenter.

So, I can add a complex presenter inside another complex presenter.

I'm trying,

presenter := MyComplexPresenter show.
container := presenter arena. "answer aCompositePresenter" .
presenter2 := MySecondComplexPresenter createIn: container.
" adds presenter2 like a subpresenter of container "

The problem is that presenter2 is not displayed inside container.

Any help ?


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Ian Bartholomew-4
Bruno,

> The problem is that presenter2 is not displayed inside container.
>
> Any help ?

It depends on what class your MySecondComplexPresenter is subclassed from -
I am guessing it is from your first post that it is Shell?. If it is then I
don't think this will work as Shell and it's subclasses expect their parent
view to be the desktop and not another kind of composite view.

Demo. Add 3 new classes to the image and give each one a default view with a
different backcolour - just to be able to see when each is displayed.

X is a subclass of Shell
Y is a subclass of Shell
Z is a subclass of CompositePresenter.

The following will not show Y as you are trying to create it in something
other than the desktop

x := X show.
Y createIn: x

but this will work as you are adding Z as a CompositeView which does not
expect a desktop as it's parent

x := X show.
Z createIn: x

Try making all your secondary presenters subclasses of CompositePresenter
and see what happens.

Ian


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Bruno Brasesco
> X is a subclass of Shell
> Y is a subclass of Shell
> Z is a subclass of CompositePresenter.

> x := X show.
> Z createIn: x

This works ok. But I have a problem with:

x := X show.
z1 := Z createIn: x.
z2 := Z createIn: x.
If i have more than 1 subpreseter in x there's repaint problem with the
subpresenters when their position change.
And when I click over z1 or z1 they not gain the focus.

I send #invalidate message to z1 and z1 when their position change but they
were repainted in a strange form, only their PushButtons are repainted.

Does Dolphin support MDI (multi document interface) ?
I think no.

I try with the PaneHolder (Bill Schwab package) but without result until
now.

Best Regards
Bruno Brasesco


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Bruno Brasesco
> x := X show.
> z1 := Z createIn: x.
> z2 := Z createIn: x.
> I send #invalidate message to z1 and z1 when their position change but
they
> were repainted in a strange form, only their PushButtons are repainted.

I fix this problem (repainting all sub view).

But now the border and the caption of z1 and z2 is not repainting with
#invalidate message.

I suppose because they are Composite.

Any idea ?

Best Regards
Bruno Brasesco


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Ian Bartholomew-4
Bruno,

> Does Dolphin support MDI (multi document interface) ?
> I think no.

And you are quite right. If you look back through the archive (do a search
on MDI) you will see this has been mentioned a number of times. I think the
feeling from OA was that as MS were, apparently, dropping MDI there was no
point in adding extra overhead to Dolphin to support it. I got the
impression from the threads I read that if you wanted MDI you would have to
simulate it yourself using the existing framework.

> But now the border and the caption of z1 and z2 is not repainting with
> #invalidate message.
>
> I suppose because they are Composite.

Not sure what you have done here but the #caption aspect is part of Shell so
it will not be available from the rest of the CompositePresenter hierarchy.
The same may also apply to Shell type borders - the resizable ones.

> Any idea ?

Not really. If you want to implement MDI functionality in a Dolphin Shell
then I guess you are going to have to do a lot more than just move a few
classes around in the hierarchy. It's not something I've ever looked into
but maybe somebody else has???

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: Add a preseter in a dynamic way

Bill Schwab
Ian,

> Not really. If you want to implement MDI functionality in a Dolphin Shell
> then I guess you are going to have to do a lot more than just move a few
> classes around in the hierarchy. It's not something I've ever looked into
> but maybe somebody else has???

It's been a long time since I messed with it.  I think STV Win shipped with
MDI code, so a glance at it might be helpful.  MDI windows will need to call
a different default window proc (not that this is a big problem), so it will
certainly be different than simply trying to embed a shell in a shell.
Actually, it will probably be a lot easier than trying to get a shell to
embed in a shell :)

Have a good one,

Bill

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