GtkField becoming the interactive search field

View: New views
5 Messages — Rating Filter:   Alert me  

GtkField becoming the interactive search field

by CsMAr51 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

Is someone able to tell me how to make a normal GtkField becoming the
interactive search field for a GtkTreeView ?

Thanks.

--
Marion Desnault

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: GtkField becoming the interactive search field

by Scott Mattocks-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Marion,

CsMAr51 wrote:
>
> Is someone able to tell me how to make a normal GtkField becoming the
> interactive search field for a GtkTreeView ?

I am not sure what you mean by GtkField, but if you want to set a search
column for a GtkTreeView, you can use GtkTreeView::set_search_column().
Take a look here:
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-set-search-column

--
Scott Mattocks
http://www.crisscott.com

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: GtkField becoming the interactive search field

by CsMAr51 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Scott,

>> Is someone able to tell me how to make a normal GtkField becoming the
>> interactive search field for a GtkTreeView ?
>
> I am not sure what you mean by GtkField, but if you want to set a search
> column for a GtkTreeView, you can use GtkTreeView::set_search_column().
> Take a look here:
> http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-set-search-column 
>

When you hit a key on a GtkTreeView (or hit ctrl+f) it opens a field for
interactive search on the GtkTreeView. I've already used
GtkTreeView::set_search_column() to do that, but I want to use a
GtkField that I've created instead of the default one. Here is the
example of what I want: http://csmar51.dyndns.org/php-gtk/replace.png

Thanks.

--
Marion DESNAULT

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: GtkField becoming the interactive search field

by Scott Mattocks-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CsMAr51 wrote:
>
> When you hit a key on a GtkTreeView (or hit ctrl+f) it opens a field for
> interactive search on the GtkTreeView. I've already used
> GtkTreeView::set_search_column() to do that, but I want to use a
> GtkField that I've created instead of the default one. Here is the
> example of what I want: http://csmar51.dyndns.org/php-gtk/replace.png

I am still not sure where GtkField comes from. I think you mean
GtkEntry. Anyway, I think I know what you are asking.

I don't think there is a method to swap out the search widget with one
of your own. Christian's dev_inspector may help you find a way to pull
it out of the treeview's (grand-)children.

This is how I would do it:
First, turn off interactive search. Then check for changes in your
GtkEntry by connecting to one of the GtkEntry signals (probably
insert-at-cursor) and then search the model (GtkTreeModel::foreach())
from your GtkTreeView. When you find a value you can scroll to the cell
your are looking for (GtkTreeView::scroll_to_cell()).

--
Scott Mattocks
http://www.crisscott.com

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: GtkField becoming the interactive search field

by CsMAr51 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I am still not sure where GtkField comes from. I think you mean
> GtkEntry. Anyway, I think I know what you are asking.
>
> I don't think there is a method to swap out the search widget with one
> of your own. Christian's dev_inspector may help you find a way to pull
> it out of the treeview's (grand-)children.
>
> This is how I would do it:
> First, turn off interactive search. Then check for changes in your
> GtkEntry by connecting to one of the GtkEntry signals (probably
> insert-at-cursor) and then search the model (GtkTreeModel::foreach())
> from your GtkTreeView. When you find a value you can scroll to the cell
> your are looking for (GtkTreeView::scroll_to_cell()).
>

Oupss, yes it was GtkEntry (I'm a bit tired :s).
It seems to be a solution to my problem, thanks for your answers !

--
Marion DESNAULT

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php