preserve checkbox status in SetString()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -598,22 +598,20 @@ void wxListBox::DoSetItemClientData(unsigned int n, void* clientData)
|
|||||||
|
|
||||||
void wxListBox::SetString(unsigned int n, const wxString& label)
|
void wxListBox::SetString(unsigned int n, const wxString& label)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetString") );
|
|
||||||
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") );
|
||||||
|
|
||||||
GtkTreeEntry* entry = GTKGetEntry(n);
|
GtkTreeIter iter;
|
||||||
wxCHECK_RET( entry, wxT("wrong listbox index") );
|
wxCHECK_RET(GTKGetIteratorFor(n, &iter), "invalid index");
|
||||||
|
wxGtkObject<GtkTreeEntry> entry(GetEntry(m_liststore, &iter, this));
|
||||||
|
|
||||||
// update the item itself
|
// update the item itself
|
||||||
gtk_tree_entry_set_label(entry, wxGTK_CONV(label));
|
gtk_tree_entry_set_label(entry, wxGTK_CONV(label));
|
||||||
|
|
||||||
// and update the model which will refresh the tree too
|
// signal row changed
|
||||||
GtkTreeIter iter;
|
GtkTreeModel* tree_model = GTK_TREE_MODEL(m_liststore);
|
||||||
wxCHECK_RET( GTKGetIteratorFor(n, &iter), wxT("failed to get iterator") );
|
GtkTreePath* path = gtk_tree_model_get_path(tree_model, &iter);
|
||||||
|
gtk_tree_model_row_changed(tree_model, path, &iter);
|
||||||
// FIXME: this resets the checked status of a wxCheckListBox item
|
gtk_tree_path_free(path);
|
||||||
|
|
||||||
GTKSetItem(iter, entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxListBox::GetString(unsigned int n) const
|
wxString wxListBox::GetString(unsigned int n) const
|
||||||
|
Reference in New Issue
Block a user