ComboBox(), again!
- From: "Jamiil Abduqadir" <jalqadir gmail com>
- To: "Gtkmm Mailing List" <gtkmm-list gnome org>
- Subject: ComboBox(), again!
- Date: Tue, 4 Mar 2008 10:41:31 -0500
It has been my intention to create a class that will simplify the
inclusion of combo widgets in my programs, the class derives from
'Gtk::VBox' and then add to it a 'Gtk::ComboBoxEntryText', like this:
------ HPP FILE
// ALL THE INCLUDES ARE HERE //
namespace jme{
class Combo : virtual public Gtk::VBox{
private:
virtual void Init();
void Pack();
Glib::ustring str;
Gtk::Label* label;
Gtk::ComboBoxEntryText* text_box;
public:
//!Constructor
Combo(Glib::ustring&);
//!Destructor
virtual ~Combo();
};// Class
}// Namespace
#endif
----- CPP FILE
void jme::Combo::Init() {
// Instantiate object widgets
label = Gtk::manage(new Gtk::Label(str.data(), Gtk::ALIGN_LEFT ));
if(label == NULL) {
DO SOMETHING
}
text_box = Gtk::manage(new Gtk::ComboBoxEntryText());
if(text_box == NULL) {
DO SOMETHING
}
this->pack_start(*label);
this->pack_start(*text_box);
}
jme::Combo::Combo(Glib:
:ustring& s) {
...
str = s;
this->Init();
...
}
jme::Combo::~Combo() { }
Later
on another class I declare my hand dandy class (jme::Combo*
entryboxFirstName;) , then I instantiate it like this
'entryboxFirstName = Gtk::manage(new jme::Combo("sometext"));' to add
it to a 'Gtk::Frame' (someFrame->pack_start(*entryboxFirstName);
This works just fine, however, the size of the combo box is too
high, high enough to fit two lines of text. Is this a normal behaviour
in GTKmm?
Please advice, thanks in advance.
--
Happiness has many doors, and when one of them closes another opens, yet we spent so much time looking at the one that is shut that we don't see the one that just opened.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]