LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 03-26-2005, 03:35 PM   #1
shmonkey
Member
 
Registered: Nov 2004
Location: UK
Distribution: Ubuntu
Posts: 118

Rep: Reputation: 15
gtkmm combobox problem


This is driving me nuts !

I am trying to figure out how you get the text from the selection of a combobox (note: not combo entry box)

I have populated the combobox Ok by attaching a liststore to it :

Code:
	// set up model for combo box
	m_refComboModel = Gtk::ListStore::create(m_Combo);
	viewComboBox->set_model(m_refComboModel);
	viewComboBox->pack_start(m_Combo.view_col);	
	
	// Set the 3 default values for the combobox
	Gtk::TreeModel::Row row = *(m_refComboModel->append());
	row[m_Combo.view_col] = "item 1";
	
	row = *(m_refComboModel->append());
	row[m_Combo.view_col] = "item 2";
	
	row = *(m_refComboModel->append());
	row[m_Combo.view_col] = "item 3";
I have a signal that is generated if the user make a selection from the combobox in the following function :

Code:
//---------------------------------------------
// User has selcted new positon in combo box
//--------------------------------------------
void window1::on_viewComboBox_changed()
{
	// get the current selection from the combobox
	// to do ........................................................
	TreeModel::iterator i = viewComboBox->get_active();
}
tried variuos ways but I can not figure out how to get the item selected.

get_active always returns 1.

Can anybody show me the light (preferably with an example)

Regards

Shmonkey
 
Old 03-26-2005, 04:20 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,857

Rep: Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121
get_active will return the position, but it's only an integer, and you're assigning it to an interator object.
 
Old 03-26-2005, 05:07 PM   #3
shmonkey
Member
 
Registered: Nov 2004
Location: UK
Distribution: Ubuntu
Posts: 118

Original Poster
Rep: Reputation: 15
Are you sure ? this is the prototype :

Code:
TreeModel::iterator get_active();
I thought

Code:
 int get_active_row_number() const;
would return the position.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gtkmm help paulr1984 Linux - Software 1 03-28-2005 02:40 AM
gtkmm HOW? Barq Programming 1 08-29-2004 07:43 AM
How to open a Combobox in GTK captainfreedom Programming 0 05-30-2004 03:26 AM
Problem installing gtkmm-1.2.8 rgraham Red Hat 1 01-30-2004 05:05 PM
Gabber 0.8.8 install problem: Gtkmm not recognized invictus Linux - Software 0 06-28-2003 11:42 AM


All times are GMT -5. The time now is 04:55 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration