Ahoy, ChucKists -

I've just coded myself a perfectly serviceable metronome, and it works fine except for a small nagging thing in the MAUI.  

In my metronome, I have 2 toggle type buttons, "thirds" and "sixteenths".  If one is on, the other is off, so i'm always subdividing the pulse one way or the other.  As it is, if I turn "thirds" on and off, the "sixteenth" button dutifully goes off and on in a complementary way.  If I do this, though:

- toggle "thirds" on ("quarters" stays off)
- toggle "quarters" on ("thirds" politely turns off)
- toggle "thirds" on 

At this point they're *both* on.  I can get back to a one-or-the-other state by fussing around and toggling the right combo of things, but i'd rather not do that.

I've attached just the button-related code below - i've got two functions set up that are turning the other button on or off depending on whether or not they're off or on.  It's bending my brain a bit to figure out why it sometimes behaves the way it does - any insights out there?

thanks, as always,

j.


------code------

MAUI_View view;
view.size(400,200);

MAUI_Button thirds;
thirds.toggleType();
thirds.size(110,110);
thirds.position(0, 100);
thirds.name("thirds");
view.addElement(thirds);

MAUI_Button sixteenths;
sixteenths.toggleType();
sixteenths.size(110,110);
sixteenths.position(110, 100);
sixteenths.name("sixteenths");
view.addElement(sixteenths);

view.display();

fun void controlThirds()
{
while (true)
{


thirds => now;
sixteenths.state(0);
<<<"thirds on">>>;


thirds => now;
sixteenths.state(1);
<<<"thirds off">>>;
}
}

fun void controlSixteenths()
{
while (true)
{


sixteenths => now;
thirds.state(0);
<<<"sixteenths on">>>;


sixteenths => now;
thirds.state(1);
<<<"sixteenths off">>>;
}
}

spork ~ controlThirds();
spork ~ controlSixteenths();

while (true)
{
1::second => now;
}