This is added to my Groups class public methods declarations in Groups.h

*  void set_tab_order(int nwidgets, int nfocus, Widget* o_1, ...);
*
This is added at the bottom of my Groups.cxx file.

*// rs-> tab reordering.  Changes tab ordering by removing and
// reinserting child widgets under their original parents in the
// new order and sets the focus widget explicitly.
void Group::set_tab_order(int nwidgets, int nfocus, Widget* o_1, ...)
{
 // both the number of widgets and the number of the widget
 // to focus are indexed base 1.  Null widgets will be skipped.

 if(nfocus <= 0) return;       // error, focus too low
 if(nfocus > nwidgets) return; // error, focus too high.
 if(nwidgets < 2) return;      // nothing to do

 // remove them all and reinsert to set
 // new tab order.
 Widget** stk = & o_1;
 int focus_index = nfocus -1;

Group* parents[256]; // this sets the limit on how many we can do at a time.

 for(int i = 0; i < nwidgets; i++)
 {
   // ignore null widgets
   if(stk[i])
   {
     Group* super = stk[i]->parent();
     parents[i] = super;
     super->remove(stk[i]);
   }
 }

 for(int i = 0; i < nwidgets; i++)
 {
   // ignore null widgets
   if(stk[i])
   {
     parents[i]->add(stk[i]);
     if(i == focus_index)
       parents[i]->set_focus(stk[i]);
   }
 }
}
*
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to