Re: Using a 2-column layout in a ComboBox



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> 		this->pack_start(m_model_columns.m_col_status_icon);
>> 		this->pack_start(m_model_columns.m_col_status_string);

I am confused by the foregoing lines of code.  You may want to lose them.

Bob Caryl

Iovene Salvatore wrote:
> Althought this has already been discussed in this list, I still can't get
> my code to work. I have a ComboBox and I want it to have 2 columns, one
> with an image, and another one with a string.
> 
> This is the relevant part of my code:
> 
> 
> The model for the column (header file):
> 
> 	class StatusComboModelColumns :
> 	public Gtk::TreeModelColumnRecord {
> 		public:
> 			StatusComboModelColumns();
> 
> 			Gtk::TreeModelColumn<
> 				Glib::RefPtr<Gdk::Pixbuf> >
> 					m_col_status_icon;
> 
> 			Gtk::TreeModelColumn<Glib::ustring>
> 				m_col_status_string;
> 	};
> 
> The model for the columns (source file):
> 
> 	StatusComboModelColumns::StatusComboModelColumns() {
> 		add(m_col_status_icon);
> 		add(m_col_status_string);
> 	}
> 
> The widget (derived from ComboBox):
> 
> 	StatusComboWidget::StatusComboWidget(
> 		BaseObjectType* cobject,
> 		const Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
> 	{
> 		m_model_statuses = Gtk::ListStore::create(m_model_columns);
> 		this->set_model(m_model_statuses);
> 
> 		Gtk::TreeModel::Row row;
> 		// available
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconAvailable();
> 		row[m_model_columns.m_col_status_string] = gettext("Available");
> 		// chatty
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconChatty();
> 		row[m_model_columns.m_col_status_string] = gettext("Chatty");
> 		// away
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconAway();
> 		row[m_model_columns.m_col_status_string] = gettext("Away");
> 		// extended away
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconXAway();
> 		row[m_model_columns.m_col_status_string] = gettext("Extended away");
> 		// do not disturb
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconDND();
> 		row[m_model_columns.m_col_status_string] = gettext("Do Not Disturb");
> 		// offline
> 		row = *(m_model_statuses->append());
> 		row[m_model_columns.m_col_status_icon] = this->getIconOffline();
> 		row[m_model_columns.m_col_status_string] = gettext("Offline");
> 
> 		this->pack_start(m_model_columns.m_col_status_icon);
> 		this->pack_start(m_model_columns.m_col_status_string);
> 	}
> 
> I really don't understand what's wrong. The ComboBox appears as empty.
> Please let me know if you find anything wrong in my code.
> 
> Thank you very much in advance!
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFE9YRQuCj6XIbb5UIRAjCmAJ9PlU1VCSUytrhSUTwpHLylUOrinwCbBpmI
ORO6W65wQIfKkvrvhCOrCZI=
=iUn1
-----END PGP SIGNATURE-----
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



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