Re: MyEntryBox



jalqadir netscape net kirjoitti:
Having a Gtk::Entry is not enough, since this object is always accompanied by a title. Thus I am racking my brains trying to figure out how to create a class that will display a Gtk::Entry with a correspondig title.
To do this I first thought of writing a class that derives from Gtk::VBox, and add a Gtk::Label for the title, and a Gtk::Entry to it. Howevery, this approach will live me reimplementing most of the Gtk::Entry's member funcions in my class, since I will need to have access to the Gtk::Entry's member function.
My question is, how can I have a class that will display the a title and an Entry box?

class MyEntryBox : public Gtk::VBox
{
	Gtk::Label label;
	Gtk::Entry entry;
public:
	// irrelevant stuff skipped...
	Gtk::Entry * get_entry() const { return &entry; }
};


MyEntryBox box;

box.get_entry()->set_text("foo");

The same idea as Gtk::Dialog::get_vbox()

Andris






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