Do widgets have to be members of class?



Forgive me for my ignorance, but I'm new to any sort of GUI development...

I'm attempting to create a table with X labels inside of it.  However, it
seems as if I can not add items to the table that are not members of the
class.  For example this will NOT work:

MainWindow.h
public:
	MainWindow();
	
protected:
	Gtk::Table my_table;
};

MainWindow.cc
MainWindow::MainWindow() :
my_table(2,2, true),
{
	add(my_table);
        Gtk::Label label("LABEL");

	my_table.attach(label, 0, 1, 0, 1);

	show_all_children();
}


It seems as if making 'label' a protected member of MainWindow is the only
way to make this work.  Is there any way around this since I do not
initially know how many labels I will need inside the table?

Thanks
-- 
View this message in context: http://www.nabble.com/Do-widgets-have-to-be-members-of-class--tp25447078p25447078.html
Sent from the Gtkmm mailing list archive at Nabble.com.



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