Re: List/tree widgets and keyboard navigation

Calum Benson <calum benson sun com> writes:

> None of the apps I've used in the GNOME environment seem to allow you to
> select an item in a list by typing the first few letters of its name
> (when the list has focus), so I assume it's not supported at the widget
> level... are there any plans to add this functionality to the standard
> GTK tree/list widgets? 
> It's really rather a useful feature, when you know what you're looking
> for in a big list-- much quicker than scrolling, and it means you don't
> have to take your hands off the keyboard.  (It also has beneficial
> implications for people who are unable to use a mouse.)

I think everybody would agree that its a nice feature for applications
to have. The observations I would make would be:

 - It can't be handled automatically by the GTK+ widgets, since:

    - It only makes sense for sorted lists.
    - A list may have 0 text columns or multiple text columns,
      and for multiple text columns, the first column is not
      always the correct column.

 - a new set of list/tree widgets are being added for GTK+-2.0; all
   the old list/tree widgets will be deprecated, if not actually
   removed. Most likely, any functionality for hadnling this
   will only be added to the new widgets.

 - This does not internationalize well. Even dead keys need
   careful handling and a language like Japanese where the
   text is composed through a preedit operation seem basically
   hopeless to me.

   Any application with seriously large lists should provide
   a search dialog so that the user can enter the search
   string in an entry with all the editing facilities 
   of the entryt.

I also have some questions about the correct behavior:

 - what is the correct behavior for a tree? My guess would
   be that it should consider only the nodes of the tree
   at the current nesting level

 - If you are handling "the first few letters", when do you
   decide to reset and start over? My personal feeling is
   that it should reset at:

    - focus in and focus out
    - any keypress other than an alphabetic key

   Note that the Windows tree widgets handle only the first
   letter, and a string like 'bbb' gives you the third 
   entry starting with 'b'.

We've added this to the TODO list for the new tree/list widgets,
and we'll certainly try to get something in; it probably
will look like:

 gtk_tree_view_add_key_navigation (GtkTreeView *tree_view,
                                   gint         model_column);

Where model_column needs to have the type G_TYPE_STRING, and
needs to be sorted in the order of strcol(). I think that's
about right, but it certainly isn't a totally trivial
thing to get right.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]