Custom "Widget" Technique Question
Roger Guay
irog at mac.com
Mon Sep 14 15:13:00 EDT 2009
Len et al,
I have worked on similar projects/problems and am very interested in
sharing thoughts such as this very valuable information from Richard
Gaskin. I use his ideas throughout, but beyond this and for a project
very similar to what you propose, I came up with the following
solution, which seems to work very well for simulations that are not
too complex.
I define and build two different kind of objects: Control objects and
Flow objects. For example, a valve would be a Control and a pipe would
be a Flow. (Obviously you could have many different types of Controls
and Flows.)
Next build a 2-dim "truth table" (this could be an array) with
Controls at the top and Flows in the first column. wherever an "x"
appears, that flow is activated when the corresponding control is
activated. IOW, anytime a control is activated, the truth table is
queried to determine which flows to animate.
As for the animation, I make extensive use of custom properties by
calling the cAnimation of an object. For example I have a radial gage
object whose cAnimation is "FRadGage t1" where FRadGage is a function
at the stack level that moves a "pointer" graphic of the control, and
t1 is the animation target value for the simulation.
Good luck and I hope this helps!
Roger Guay
On Sep 13, 2009, at 11:00 AM, use-revolution-request at lists.runrev.com
wrote:
> Check out the new Behaviors in v3.5. This will let you use a button
> script that you could put anywhere (I tend to put mine in a library
> or a
> substack, depending on whether I plan to reuse them in other apps or
> not), and then assign the behavior of your template group to that
> button
> script. From then on it's really easy, since all your code is in
> one place.
>
> Using getProp and setProp you can adjust any number of things within
> the
> group from a single property setting.
>
> And if you use v3.5's new selectGroupedControls property for groups,
> you
> can keep your layout work clean since the pointer tool will treat the
> group as a single object, regardless of the setting of the global
> property of the same name.
>
> Use "copy <grpDescriptor> to <destinationStackDescriptor>" to add
> copies
> of groups to your layout.
>
> Keep us posted on how this goes. I love simulations, and would love
> to
> see what you come up with.
>
> --
> Richard Gaskin
> Fourth World
More information about the use-livecode
mailing list