Re: Interactive search (was: Re: Missing drag'n'drop methods in GtkTreeView)



On Sat, 16 Aug 2003 19:33:31 -0400, muppet wrote:

Hrm. What did you do to get it called? I do

all i did was make sure the list was focused, NOT the headers, and do 
C-f, and then i got a little interactive search box at the bottom,
into which i could type stuff.  the callback was called for every
letter i typed.

I found the culprit: I used "emacs" as the text editing mode and thus
C-f was supposedly bound to "move forward", overriding the interactive
search shortcut. (I don't see why those emacs bindings apply to tree
views, though.)

Anyways, now that I can test the callback, I figured out what you're
supposed to do: return 0 if the given cell matches the key, 1 otherwise.

For example:

  $view -> set_search_equal_func(sub {
    my ($model, $column, $key, $iterator) = @_;

    if (index($model -> get_value($iterator, $column), $key) > -1) {   
      return 0;
    }

    return 1;
  });

With some ev(i|a)l magic you could also use that to wait until what the
user entered is a valid regular expression and then match the cells
against it. This would be pretty cool, if this input window just wasn't
that ugly.

Maybe that's a candidate for the FAQ.

Bye,
-Torsten



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