Now I saw that you've created new functions to position a tree_item and  
using then to automatic scroll the tree with keyboard navigation:


            case FL_Up:         // next item up
            case FL_Down: {     // next item down
              set_item_focus(next_visible_item(_item_focus, ekey));     // next 
item  
up|dn
              if ( _item_focus ) {                                      // item 
in focus?
                if ( _prefs.selectmode() == FL_TREE_SELECT_MULTI &&     // 
multiselect on?
                     (Fl::event_state() & FL_SHIFT) &&                  // 
shift key?
                     ! _item_focus->is_selected() ) {                   // not 
already selected?
                    select(_item_focus);                                // 
extend selection..
                }
  //code bellow allow automatic scrolling with keyboard
              switch (ekey) {
              case FL_Up:
                if(_item_focus->y() < y()) show_top(_item_focus);
                break;
              case FL_Down:
                if((_item_focus->y()+_item_focus->h()) > (y()+h()))  
show_bottom(_item_focus);
                break;
              }         
  //code end automatic scrolling
                return(1);
              }
              break;
            }


En 12/08/2010 10:22:58, Domingo Alvarez Duarte <[email protected]>  
escribió:

> It seems that for some reason you didn't saw or like my sugestion that
> allows automatic scroll of the the tree when navigating with keyboard:
>
>           case FL_Up:         // next item up
>           case FL_Down: {     // next item down
>             set_item_focus(next_visible_item(_item_focus, ekey));     // next 
> item
> up|dn
>             if ( _item_focus ) {                                      // item 
> in focus?
>               if ( _prefs.selectmode() == FL_TREE_SELECT_MULTI &&     // 
> multiselect on?
>                    (Fl::event_state() & FL_SHIFT) &&                  // 
> shift key?
>                    ! _item_focus->is_selected() ) {                   // not 
> already selected?
>                   select(_item_focus);                                // 
> extend selection..
>               }
> //code bellow allow automatic scrolling with keyboard
>             switch (ekey) {
>             case FL_Up:
>               if(_item_focus->y() < y())
> vscroll->value(vscroll->value()-_item_focus->h());
>               break;
>             case FL_Down:
>               if((_item_focus->y()+_item_focus->h()) > (y()+h()))
>                       vscroll->value(vscroll->value()+_item_focus->h());
>               break;
>             }         
> //code end automatic scrolling
>               return(1);
>             }
>             break;
>           }
>
>
>
> En 12/08/2010 03:32:31, Greg Ercolano <[email protected]> escribió:
>
>> Another updated Fl_Tree patch against a clean r7680; more features.
>> http://seriss.com/people/erco/fltk/tmp/Fl_Tree-add-keyboard-nav-to-r7680-08-11-10--5pm.patch
>>
>>     * Added Domingo's recommended Fl_Tree_Item accessors x() / y() /  
>> w() / h()
>>
>>     * Added Fl_Tree::show_item(), show_top(), show_middle(),  
>> show_bottom().
>>       This lets one procedurally scroll the display to make the  
>> specified item visible
>>       at particular positions on the display. (for Mayank Malik)
>>
>>     * Added Fl_Tree::first_selected_item() and  
>> Fl_Tree::next_selected_item().
>>       With this you can loop through just the selected items.
>>
>>     * tree demo modified to include top/mid/bot buttons that test the  
>> above.
>>       To use this, select an item in the display, and hit Top/Mid/Bot  
>> buttons
>>       to position that item in the display. Scrollbar must be able to  
>> move to
>>       show the item, so it's best to have e.g. the "500 Items" tree  
>> open, and
>>       select an item that is somewhere lower in the list.
>>
>>     * vscroll widget is public, so caller can directly manipulate the  
>> scrollbar.
>>       (Using Fl_Browser as a model here.. not sure if this is a bad  
>> idea or not.
>>       This might be backed out)
>>
>>         TODO:
>>                 o autoscroll during selection/focus navigation
>>
>>                 o Need a callback system that is invoked when items are  
>> open/closed
>>
>>                 o Need to allow keyboard nav to move focus to child  
>> FLTK widgets
>
>


-- 
Usando el revolucionario cliente de correo de Opera:  
http://www.opera.com/mail/
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to