Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to expand ImagePresenter - help needed

14 views
Skip to first unread message

Catalin Aramescu

unread,
Apr 9, 2012, 5:03:14 PM4/9/12
to
Hi all,

I try to make a small GUI application for Einstein's problem (see
http://imageshack.us/photo/my-images/696/einsteinx.jpg/) and I some
problems adding Image presenters in a container.

If you look at the picture you see a 5 rows of 5 columns. Each row is
a composite presenter having a layout of type GridLayout. In each
composite I try to insert dynamically 5 presenters of type
EinsteinImagePresenter, that is subclass of ImagePresenter.
Bellow is a piece of code for the row of houses
(EinstainProblemPresenter is the shell).

EinstainProblemPresenter>>createHousePresenters
self model houses do:
[:each |
| hp |
hp := Presenter createIn: housesContainer on: each.
hp view layoutManager: GridLayout new.
EinsteinImagePresenter createIn: hp on: hp model picture]

Here 'each' is an instance of EinsteinActor (that has as instance
variables a name, a description and
a position).
You can see that for every house I add a new presenter that will
contain the EinsteinImagePresenter presenter because I want to be able
to access the EinsteinActor model and because the ImagePresenter
superclass expects a picture as model.
It's a rather contrived solution. I would like to eliminate the
intermediary presenter, and to have the full EinsteinActor as the
model for the EinsteinImagePresenter.

I have the feeling that there's a simple solution using ValueAdaptors
but I don't have too much experience with them (maybe a new video on
this topic would be beneficial).

I can send the package to anyone who wants t help me.

Thanks in advance,
Catalin Aramescu
0 new messages