Really fed-up how can i set call back on enter key of GtkTextView Widget. For which event i can listen?
Thanks开发者_如何转开发.
gboolean on_key_press (GtkWidget * widget, GdkEventKey* pKey,gpointer userdata){
if (pKey->type == GDK_KEY_PRESS){
g_print("%i\n", pKey->keyval);
switch (pKey->keyval)
{
case GDK_Enter :
gtk_main_quit ();
break;
}
}
return FALSE;
}
Callback can be registered using :
GtkWidget *view;
view = gtk_text_view_new();
g_signal_connect(view, "key_press_event", G_CALLBACK(on_key_press), NULL);
**
Please visit this page for more information :
**
I tried GDK_Enter
but I got an error
error: ‘GDK_ENTER’ undeclared (first use in this function)
Using GDK_Return
fixed things
In my program (python) I have
renderer = Gtk.CellRendererText()
renderer.set_property("size", 30000)
renderer.set_property('cell-background', 'yellow')
This sets the size and background.
You need to look for something similar.
精彩评论