Post by Ian MacArthurPost by Frank G HaymesCan someone to point me to a toggle switch widget?
There's no 3-position switch that I'm aware of.
When I needed this, I just put 3 radio-buttons in a group and that was fine - and trivial to do.
Ya, or an Fl_Menu_Button with three items in it -- less screen real estate.
Use that if the user only needs to see which state the switch is in.
Otherwise, use the radio button approach if it's more useful that the user
see all three things, and which one of the three is "on".
A "toggle switch" or "3 position dial" would simulate the real world better,
but is perhaps not a good paradigm visually.
But if you really want to go that route, paint three images of the switch
in the various positions, and derive a class from Fl_Button that has one
of the switch images assigned as the image() for the button, and each hit
of the button switches the image() to show the other painting of the switch.
Set it up so that each hit toggles to the next of the three states. Use a char
or int to keep track of the current state, and just cycle through it each click;
0-1-2-1-0-1-2.. or 0-1-2-0-1-2.. whichever is best.