Re: Editable GtkCellRendererText, troubles with the GtkEntry...
- From: Axel FILMORE <axel filmore gmail com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Editable GtkCellRendererText, troubles with the GtkEntry...
- Date: Wed, 13 Jun 2012 12:06:55 +0200
Probably I'll have to implement my own text renderer and probably a
GtkTextView is a better choice :
http://s16.postimage.org/8zivb78ph/icon_edit.png
Using a GtkFixed and then a GtkTextView with word wrap :
Gtk.Fixed fixed = new Gtk.Fixed ();
this.add (fixed);
fixed.show_all ();
Gtk.TextView icon_edit = new Gtk.TextView ();
icon_edit.set_size_request (72, 16);
icon_edit.wrap_mode = Gtk.WrapMode.WORD_CHAR;
icon_edit.show_all ();
fixed.put (icon_edit, 95, 200);
Not too bad :-P
Probably I'll have to use gtk_text_view_im_context_filter_keypress () to
filter particular keys and it should work.
http://developer.gnome.org/gtk3/3.0/GtkTextView.html#gtk-text-view-im-context-filter-keypress
:)
On 13/06/2012 06:18, Axel FILMORE wrote:
Hi there,
I try to use a GtkCellRendererText to display and edit an icon text.
I already use a GtkCellRendererPixbuf to display the icon and it works
fine, displaying the text also works :
http://s9.postimage.org/klhpmqcj3/gtkentry.png
But for some reasons, I can't get a visible GtkEntry to edit the text.
I've set the editable property and connected signals (in Vala) :
_text_renderer = new Gtk.CellRendererText ();
_text_renderer.editable = true;
_text_renderer.mode = Gtk.CellRendererMode.EDITABLE;
this._text_renderer.edited.connect ( (renderer, path, text) => {
stdout.printf ("edited\n");
});
this._text_renderer.editing_canceled.connect ( () => {
stdout.printf ("editing_canceled\n");
});
this._text_renderer.editing_started.connect ( (editable, path) => {
stdout.printf ("editing_started\n");
});
I try to call start_editing so that the text can be edited :
this._text_renderer.start_editing (null, _desktop, "", item.text_rect,
item.text_rect, state);
Then I get the editing-started signal, the editable is created but I
can't get it visible.
The parent widget is a GtkWindow with custom drawing, is it what cause
some troubles ?
I tried to find a clue in GtkCellRendererText :
http://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrenderertext.c#n2028
The function creates a GtkEntry, that should work at first glance.
I only receive the editing-started signal, but no GtkEntry, no edited or
editing-canceled.
Any idea would be welcome :)
Thanks.
--
Axel FILMORE
#--------------------------------------------#
https://github.com/afilmore
#--------------------------------------------#
Vala - Compiler For The GObject Type System
https://live.gnome.org/Vala
#--------------------------------------------#
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]