[SOLVED] GtkCellRendererToggle toggles when clicking on other cell renderers in same column
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am working on a C++ GTK project. I have a GtkTreeView containing several columns. In the first column, I have packed in 3 cell renderers - the first, a GtkCellRendererToggle; the second, a GtkCellRendererPixbuf; the third, a GtkCellRendererText. Everything works fine, except that clicking on the text in the GtkCellRendererText causes the 'toggled' event to fire on the GtkCellRendererToggle. This is no good in this particular case. Is there any way, besides keeping track of where the mouse pointer is, to determine whether the user clicked on the checkbox itself or another cell renderer in the same column? Thanks in advance for any ideas.
/*sixth column - name of package used to fulfill requirement, if one is needed*/
renderer=gtk_cell_renderer_combo_new();
pkgPropDependencies_depVersionComboModel=GTK_TREE_MODEL(gtk_list_store_new(1, G_TYPE_STRING));
g_object_set(GTK_CELL_RENDERER_COMBO(renderer),
"model", pkgPropDependencies_depVersionComboModel,
"has-entry", false,
"text-column", 0,
"editable", true, NULL);
g_signal_connect(renderer, "edited", G_CALLBACK(on_pkgPropDependencies_depVersionCombo_changed), NULL);
column=gtk_tree_view_column_new_with_attributes("Version to Be Installed", renderer, "text", PKG_PROP_DEPENDENCIES_COLUMN_VERSION, NULL);
gtk_tree_view_append_column(pkgPropDependencies, column);
}
Last edited by grumpybuffalo; 08-10-2009 at 05:52 PM..
Reason: Forgot to say thanks.
I changed the GtkCellRendererText to a GtkCellRendererCombo. I didn't add any items to the combo or even set the model of the combo; the only property I set was the "editable" property to true. This created exactly the functionality I was looking for. The user can't even tell that the cell renderer is a combo box, because it has nothing in it. Clicking on the combo does not toggle the GtkCellRendererToggle. I suppose this is because GTK no longer considers the column one activatable entity.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.