Hey all,
I have a bunch of agents laid out in an environment. I want to be able to drill down into them for more information by
clicking on them. Basically, if I'm on my "main" object, I see all my agents and a summary of their states...
when I click, I want to go to the presentation for the agent I clicked.
Any advice?
Thanks,
Willy
Pavel — 20.05.10
Hi Willy,
Please go inside agent class and select its presentation. Then go to dynamic properties and type the following line of
code in "On click" field:
getPresentation().setPresentable(get_Main().myAgent.get(getIndex()));
Willy — 26.05.10
Hey Pavel,
Thanks... that's really working. My only issue with this is that after the drill-down, the embedded agent's display is
offset by the same X,Y values that it's presentation is being offset in the owner.
Does that make sense? Essentially, if I have 9 objects laid out in an environment in a 3x3 grid... when I click the
agent at 1,1 it's presentation is aligned with the upper left corner of the screen. if I click the agent at 3,3 I get a
big left and top margin that equals the position of the replicated object in the 3x3 grid. Any thoughts?
/w
Pavel — 03.06.10
Hi Willy,
This behavior is normal. When you go inside specific agent, you will see its presentation on the same coordinates as in
Main since the presentation object is common for Main and Agent.
Willy — 10.06.10
Hey Pavel,
Thanks again!
So... I have a thumbnail of the specific agent with a summary of the agent's info. The rest of the agent's presentation
is visible=false. When I click on the agent in the embedding environment, I'm doing a navigateTo() to the detail
viewArea on the specific agent. At that time, I'm setting the thumbnail.visible = false, and the detailed information
to visible=true. I want it to work a bit like a Master/Detail design on a web site. I have the thumbnails laid out in
a grid, and when I click one, I want to go to the specific agent's "page".
To put a slightly finer point on it: This is a highly hierarchical model. The main ActiveObject has about 20 agents
embedded in it, laid out in a grid by an environment. Each of those agents has maybe 50 other agents embedded within
it, again, laid out in a grid so I can see a summary of all those agents' states. And again and again. The hierarchy
is about 5 branches deep... so, if I click click click down to the bottom, my leaf-nodes are all the way off the screen.
I recognize the normalcy of this behavior... makes sense for a lot of use cases... doesn't work great for mine! Any
suggestions for a work-around?
/w
Willy — 10.06.10
Hey Pavel,
Here's an example of what I mean. Can you take a look? Maybe I'm doing it the wrong way!
http://drop.io/p0hr63m
/w
Pavel — 09.07.10
Hi Willy,
When you navigate inside e.g. "Building" agent, you should call the code that places the required shapes and
controls near the left upper corner. For instance, if I want the oval to be placed near the this corner, I should add
the following code after the line "floorsView.navigateTo();":
oval.setPos( -get_Main().building.get(getIndex()).getX(), -get_Main().building.get(getIndex()).getY() );
I hope it will help you.
Willy — 10.07.10
Hey Pavel,
Yeah, I was thinking about that... it's awfully clunky to either do that with every shape in the presentation or to
create a group of the entire presentation.
What I've settled on is drawing the thumbnail manually on the embedding class... so, the simplest example would be a
text element with the following dynamic values, e.g.:
replications: building.size()
y: 20+20*index
text: building.get(index).toString() - (overridden by me to say what I want...)
click: building.get(index).myViewArea.navigateTo();
This also is somewhat clunky, as I have to replicate all the shapes and texts that make up the "thumbnail",
but seems less clunky to me than the alternative, and avoids the necessity of having to set some parts of the building
presentation visible or invisible based on whether I'm navigated to it or not.
I guess what this comes down to is I'd like to suggest a feature... I want the option to disconnect the presentation of
embedded objects from the presentation of the embedding object. I want to be able to check a box on the Active
Object:General tab that makes it so the offset you suggest in your previous post is automatic for the whole presentation
of that class. Does that make sense? I can post an example of the workaround I've implemented... I'll update the
City->Building->Floor->Room model I had above.
/willy
Willy — 11.07.10
Hey Pavel,
I've posted a version of my buildings model with my workaround on it. Please check it out at:
http://drop.io/p0hr63m
I think you'll be able to see what I'm going for...
/w
Willy — 12.07.10
Alternatively, is there a way to loop through the presentation elements as a collection, calling that setPos() function
on all of them?
/w