Hi,

I'm using fltk2-6844. I had created a class that is derived from fltk::Button. 
This class should store additional type information in Widget::type() as 
described in the docs: "Widget subclasses may store values in the range 0-99 
here (larger values are reserved for use by FLTK)". But when I store and value 
in this area the button works always as a toggle button.
Looking in the FLTK source code I've found the problem: The button state is 
always checked like this:
if (type() == RADIO) {
  ...
} else if (type()) { // TOGGLE
  ...
} else {
  ...
}
So any type unequal zero or unequal RADIO will force a toggle button. If the 
toggle button is explicit checked like the radio button (e.g. if (type() == 
TOGGLE)) this will force any subclass type to a normal push button which is 
also not desired. I think the best way will be only to check the reserved bits 
of the type variable like this.
if (type() & RADIO) {
  ...
} else if (type() & TOGGLE {
  ...
} else {
  ...
}
This will make it possible to use the free range of the type variable in 
subclasses.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to