disabling a widget when no rows are selected problem
- From: Colossus <colossus 3000 it>
- To: gtk-app-devel-list gnome org
- Subject: disabling a widget when no rows are selected problem
- Date: Mon, 05 Sep 2005 15:49:50 -0700
Hi,
I have a gtk_image_menu_item_new_from_stock that I want to enable /
disable when rows are selected and not selected. The problem is that
when I click on a row who is selected it is not unselected but remains
selected. So the function gtk_tree_selection_count_selected_rows
return > 0 and the following if does not work:
if (selected < 0 && GTK_WIDGET_SENSITIVE ( Delete_button) )
gtk_widget_set_sensitive (Delete_button,FALSE);
else gtk_widget_set_sensitive (Delete_button,TRUE);
The complete function that I call when I click on the rows is:
void Activate_delete_button()
{
GtkTreeSelection *selection = gtk_tree_view_get_selection (
GTK_TREE_VIEW (treeview1) );
gint selected = gtk_tree_selection_count_selected_rows ( selection );
if (selected < 0 && GTK_WIDGET_SENSITIVE ( Delete_button) )
gtk_widget_set_sensitive (Delete_button,FALSE);
else gtk_widget_set_sensitive (Delete_button,TRUE);
g_print ("**%d\n",selected);
}
Any help would be greatly appreciated.
--
Colossus
Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]