Hi,
Here the line of code where i emmit the signal and want to select the toggle
renderer. So please have a check this and help me in right way that where i
should do and where i change the modal of it.
Please help me out!
gtk_tree_store_new(TRACK_LIST_NUM_COLS, G_TYPE_BOOLEAN,
GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER);
gtk_tree_view_set_model(GTK_TREE_VIEW(m_pFileTreeView),
GTK_TREE_MODEL(pTreeStore));
GtkCellRenderer *pRendererCheck = gtk_cell_renderer_toggle_new();
pTreeCol = gtk_tree_view_column_new();
gtk_tree_view_append_column(GTK_TREE_VIEW(m_pFileTreeView), pTreeCol);
gtk_tree_view_column_pack_start(pTreeCol, pRendererCheck, FALSE);
gtk_tree_view_column_set_attributes(pTreeCol, pRendererCheck,
"activatable",
RACK_TOOGLE_BOX_COL, NULL);
g_signal_connect((gpointer) pRendererCheck, "toggled", G_CALLBACK
(OnCellToggled), this);
// Function emitting signal here
void OnCellToggled(GtkCellRendererToggle *pCellRenderer, gchar *path,
gpointer pUserData)
{
gboolean bActive = gtk_cell_renderer_toggle_get_active (pCellRenderer);
if (bActive)
bActive = FALSE;
else
bActive = TRUE;
gtk_cell_renderer_toggle_set_active(pCellRenderer, bActive);
}
// Set the data in tree view
GtkTreeStore *pTreeStore =
GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pFileTreeView)));
GtkTreeSelection *pTreeSelection =
gtk_tree_view_get_selection(GTK_TREE_VIEW(pFileTreeView));
gtk_tree_view_get_selection(GTK_TREE_VIEW(pFileTreeView));
gtk_tree_selection_set_mode(pTreeSelection, GTK_SELECTION_BROWSE);
GtkTreeIter cSessionIter;
gtk_tree_store_append(m_pTreeStore, &m_cTrackIter, &cSessionIter);
gtk_tree_store_set(m_pTreeStore, &m_cTrackIter,TRACK_TOOGLE_BOX_COL, "",
TRACK_LIST_PIXBUF_COL, m_cLanguageIconList[0],
TRACK_LIST_NAME_COL, (LPCTSTR) _T("this"),
TRACK_LIST_START_COL, (LPCTSTR) _T("is"),
TRACK_LIST_LENGTH_COL, (LPCTSTR) _T("the"),
TRACK_LIST_MODE_COL, (LPCTSTR) _T("way"),
-1);
}
Thank you!
From: David Neèas (Yeti) <yeti@xxxxxxxxxxxxxxx>
To: gtk-list@xxxxxxxxx
Subject: Re: Selection of Toogle Button in a tree view
Date: Tue, 14 Nov 2006 09:28:27 +0100
On Tue, Nov 14, 2006 at 08:10:09AM +0000, Saba Khan wrote:
>
> I want to select single toggle button in a tree as i already used
"toggled"
> signal to select the check box.
This does not make sense, the signal is *emitted* by the
check box. You only catch it and change the model
accordingly.
> But problem is that when me going to select single toggle button in a
tree
> view, multiple check boxes selected in all rows of tree view.
You probably tamper with the cell renderer instead of
changing the model and letting the thing update itself.
Yeti
--
Whatever.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
_________________________________________________________________
Windows Live? Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list