[Xerte] toggle button
Dave Burnett
d_b_burnett at hotmail.com
Tue Apr 13 19:45:46 BST 2010
In your original case, you would be telling children that hadn't been instantiated yet to do something.
So they get drawn regardless of what you tell them before hand.
In the second example, with the code below the object, we get a case of this flow:
Draw me> am I visible?> Yes> Hide me!
So you would never see the object.
In both my and Julian's examples, the re-drawing issue is taken out of the equation.
Julian ignores the _visible state and uses an independent variable to toggle it, my example draws it once separately from the toggling sequence, so the _visible state can be reliably tested.
HTH,
Dave
________________________________
> Date: Tue, 13 Apr 2010 14:21:55 -0400
> To: xerte at lists.nottingham.ac.uk
> From: maryann at moberg.com
> Subject: RE: [Xerte] toggle button
>
>
>
> Separating the flag from the visible state of the text must be the
> key. It even works if the script that initializes the flag is
> removed since it must be initialized to all zeros when it's
> created.
>
>
> Thanks!
>
> ma
>
>
> At 04:26 PM 4/13/2010 +0100, you wrote:
>
> See attached. I think when the
> code runs, p1_visible is not true. That’s because (I think) it hasn’t
> been drawn to the screen yet.
>
>
>
> From: xerte-bounces at lists.nottingham.ac.uk
> [
> mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Mary
> Ann Ahearn
>
> Sent: Tuesday, April 13, 2010 3:34 PM
>
> To: Xerte discussion list
>
> Subject: RE: [Xerte] toggle button
>
>
>
> Thanks, Julian, but I must be doing something very wrong because I cannot
> get it to work if the panel is a child of the button.
>
>
> I made a very simple test - if I move p1 outside of the interaction icon
> all is fine (with a script added to make it invisible at the start).
>
> When I run it as shown, I never see the panel.
>
> If I take toggle script off he button, the panel appears as expected but
> of course does not go away on second click.
>
>
> Thanks for your help,
>
> ma
>
>
> [[]]
>
>
>
> At 07:53 PM 4/12/2010 +0100, you wrote:
>
>
> Content-class: urn:content-classes:message
>
> Content-Type: text/html;
>
>
> charset="iso-8859-1"
>
>
> use some code in the response to toggle
>
>
>
> if (myIconID._visible == false){
>
> //make my items visible
>
> myIconID._visible = true;
>
> } else {
>
> //make them invisible
>
> myIconID._visible = true;
>
> }
>
>
>
> the icons could be children of the button - or could be elsewhere,
>
>
>
> HTH,
>
>
>
> J
>
> ________________________________
>
>
> From: xerte-bounces at lists.nottingham.ac.uk on behalf of Mary Ann
> Ahearn
>
> Sent: Mon 12/04/2010 18:38
>
> To: xerte at lists.nottingham.ac.uk
>
> Subject: [Xerte] toggle button
>
>
> Hi everyone.
>
> I've been preparing desktop xerte models to use in projects where a
>
> group of us will need to produce large amounts of content in short
>
> amounts of time. I want to make & save a model of a button
>
> interaction where the button is a toggle to display/hide a panel
>
> containing text and sometimes a graphic. Very simple.
>
>
> Since a button's mission seems to be to display a response when
>
> clicked, I've been struggling to get it to act as a toggle and hide
>
> the response when clicked again. If I put a script on the button
> to
>
> always reverse the visibility of its child icons, I can't seem to
> get
>
> it to overcome its desire to make them visible.
>
>
> If the panel/text/graphic are siblings of the interaction icon which
>
> contains the button rather than its children, the toggle works
>
> perfectly, but then we lose the ability to save the interaction icon
>
> as a tidy model with everything needed contained inside.
>
>
> Is there a way to disable or replace a button's default behavior
>
> regarding it's children?
>
>
> Thanks so much!
>
> ma
>
>
> _______________________________________________
>
> Xerte mailing list
>
> Xerte at lists.nottingham.ac.uk
>
>
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> _______________________________________________
>
> Xerte mailing list
>
> Xerte at lists.nottingham.ac.uk
>
>
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
>
>
>
>
> _______________________________________________
>
> Xerte mailing list
>
> Xerte at lists.nottingham.ac.uk
>
>
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5fd6c46.png
Type: application/octet-stream
Size: 39009 bytes
Desc: not available
Url : http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20100413/8300f8a8/5fd6c46.obj
More information about the Xerte
mailing list