Re: no duplicate items TreeView/ListStore



Jason Burchfield wrote:

I'm still not understanding the TreeView/ListStore classes very well. Could anyone tell me how to not allow duplicate items in just a simple list?

The only way I have found to do it is make a callback function...
and use a bool m_UserNameFound to determine if it is in the list. Is there a better way?


m_refListStore->foreach_iter( sigc::mem_fun( *this, &winPreferences::m_bFindUserName ) );


bool winPreferences::m_bFindUserName( const Gtk::TreeModel::iterator &iter ){ Glib::ustring strText = txt_D_User_Name->get_text();
   Gtk::TreeModel::Row row = *iter;
   string strTest = row[m_ModelColumns.m_col_text];
if ( strText == strTest ){
       m_UserNameFound = true;
       return true;
   }
else
       return false;
}

--
Jason Burchfield
CAS, Inc.
(256) 971-6096
Jason Burchfield cas-inc com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]