NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: lookang on September 18, 2008, 02:50:57 pm



Title: how to make object to be drawn when conditions are meet?
Post by: lookang on September 18, 2008, 02:50:57 pm
ElementsParticle
Particle: An interactive particle.

http://www.um.es/fem/EjsWiki/index.php/Main/ElementsParticle(http://www.um.es/fem/EjsWiki/uploads/Main/ElementsParticleProperties.png)

i was reading this but i can't get a feel of how to solve this problem i have.

when
mode.equals("edit_v-t_graph")

i want to draw ParticleSet_movable

else

don't draw this object.

how do i program it ?


currently i can achieve visibility state  "False"but because i also have codes in On Drag property
dsnap();
dragvt()

so the objects interact with user despite being not visible. :(


Title: Re: how to make object to be drawn when conditions are meet?
Post by: Fu-Kwun Hwang on September 18, 2008, 03:46:01 pm
You can set Visible property to mode.equals("edit_v-t_graph") if you want it to be drawn on the condition that mode.equals("edit_v-t_graph") is true.

You can only drag an object when it is visible. (Unless you draw the object the same color as the background-- the object was draw but user might not be able to see it. this is different case)

Is this what you want?


Title: Re: how to make object to be drawn when conditions are meet?
Post by: lookang on September 18, 2008, 04:35:01 pm
only after posting n reading ur post then i understand in the xml there are 2 set of objects drawing in the v-t graph.
this is important quote"You can only drag an object when it is visible. "

one is the set of ParticleSet_movable2 | visible mode.equals("edit_v-t_graph") | OnDrag dragvt();
dsnap(); |
other one  is the Polygon_line_during_edit_options | visible mode.equals("edit_v-t_graph") | OnDrag dragvt();

what i did that i think achieve what i want is to create another object called Polygon_line_for_non_edit_options | mode.equals("simple_acceleration")||mode.equals("uniform_motion")||mode.equals("simple_deceleration")||mode.equals("rise_and_fall")||mode.equals("fall_and_rebounce") |  DragOn  "BLANK" !!!!

done!!!

yes you r right, i will try to rearrange the simulation vertical from current horizontal ASAP :)

Thanks!