Author: spitzak
Date: 2007-06-17 11:45:10 -0400 (Sun, 17 Jun 2007)
New Revision: 5909
Log:
Radio widgets must be adjacent to be considered the same group.
Change suggested by Ali Azarbayejani, sounds good to me.
Modified:
trunk/src/Widget.cxx
Modified: trunk/src/Widget.cxx
===================================================================
--- trunk/src/Widget.cxx 2007-06-17 15:35:16 UTC (rev 5908)
+++ trunk/src/Widget.cxx 2007-06-17 15:45:10 UTC (rev 5909)
@@ -1049,15 +1049,23 @@
}
/*!
- Calls set() on this widget and calls clear() on all other widgets in
+ Calls set() on this widget and calls clear() on all adjacent widgets in
the same parent Group that have the type() set to RADIO.
*/
void Widget::setonly() {
set();
- for (int i = parent()->children(); i--;) {
- Widget* o = parent()->child(i);
- if (o != this && o->type() == RADIO) o->clear();
+ Group* g = parent();
+ int my_index = g->find( this );
+ for( int i = my_index-1; i >= 0; --i ) {
+ Widget* c = g->child(i);
+ if( RADIO != c->type() ) break;
+ c->clear();
}
+ for( int i = my_index+1; i < g->children(); ++i ) {
+ Widget* c = g->child(i);
+ if( RADIO != c->type() ) break;
+ c->clear();
+ }
}
//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit