mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 06:14:28 +08:00
Fix browser test (#1400)
Switching browser type when items were already selected had unexpected side effects.
This commit is contained in:
+8
-2
@@ -144,12 +144,18 @@ void sort_cb(Fl_Widget *, void *) {
|
||||
}
|
||||
|
||||
void btype_cb(Fl_Widget *, void *) {
|
||||
for ( int t=1; t<=browser->size(); t++ ) browser->select(t,0);
|
||||
browser->select(1,0); // leave focus box on first line
|
||||
// Switching browser type is not a typical use, so we want to make sure that
|
||||
// everything is deselected, resetting internal variables.
|
||||
browser->deselect(1);
|
||||
if ( strcmp(btype->text(),"Normal")==0) browser->type(FL_NORMAL_BROWSER);
|
||||
else if ( strcmp(btype->text(),"Select")==0) browser->type(FL_SELECT_BROWSER);
|
||||
else if ( strcmp(btype->text(),"Hold" )==0) browser->type(FL_HOLD_BROWSER);
|
||||
else if ( strcmp(btype->text(),"Multi" )==0) browser->type(FL_MULTI_BROWSER);
|
||||
// Reset the selctions again, so all class memebr varaibles are matching
|
||||
// the new browser type.
|
||||
browser->deselect(0);
|
||||
// Set the focus rect to the topmost item without selecting it.
|
||||
browser->select(1, 0);
|
||||
browser->redraw();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user