[Win32] Layout and look&feel



Hey folks!
 
OK, huff, I hit a wall people. I just can't get this program to display the ComboBox within an acceptable size!
I can manipulate the width of the widget, but getting the height to a more suitable size has proven to be a real challenge.
Below is the code for the program and if you have to look at the window I can send you a 'GNP' file that will show you what I mean.
 
Please note that I am using the Win32 version of Gtkmm and that many times I have had gone a great length to fix a problem, just to realize that the problem lies within the Win32 port of the toolkit.
 
Thanks in advance.
----- h file ---
namespace jme{
//! \brief This class is thrown in the case of an exception
class BoxEntryEx : public virtual jme::Exception {
public:
    BoxEntryEx( jme::error_t ec, const std::string& f,
                const std::string& m, size_t l ) {
        setException( ec, f, m, l );
    }
    virtual ~BoxEntryEx()throw(){}
};//Class
class IOBoxBase : public Gtk::VBox{
protected:
    virtual void Init() throw(jme::BoxEntryEx );
    void setTitle(const char*) throw(jme::BoxEntryEx);
    int max_len;
    int height;
    int width;
    Glib::ustring title;
    Glib::ustring text;
    Gtk::Label* label;
public:
    IOBoxBase(){Init();}
    virtual ~IOBoxBase(){};
}; //class
 
 
class ComboBox : virtual public jme::IOBoxBase{
private:
protected:
    virtual void Init() throw(jme::BoxEntryEx );
    Gtk::ComboBoxEntryText* combo_box;
public:
    ComboBox(){Init();}
    ComboBox(const gchar*,              //Title
             gint)                      //Vertical padding
             throw(jme::BoxEntryEx );   //Exception
    virtual ~ComboBox(){}
    Gtk::ComboBoxEntryText* getHandle() {return combo_box;}
}; //class
}  // namespace
 
--- cpp file ---
void jme::IOBoxBase::Init()
throw(jme::BoxEntryEx ){
    try{
        label = Gtk::manage(new Gtk::Label());
    }catch(...){
        jme::BoxEntryEx e( mem_alloc, FILE, METHOD, LINE );
        e.record("error_log.txt");
        throw e;
    }
    text = "unknown";
    height = 20;
    width  = 20;
    label->set_label(text);
    label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_BOTTOM);
}
void jme::IOBoxBase::setTitle(const char* c)
throw(jme::BoxEntryEx ){
    title.assign(c);
    if(title.empty()){
        title.clear();
        jme::BoxEntryEx e( str_empty, FILE, METHOD, LINE );
        throw e;
    }
    label->set_label(title);
}
void jme::TextEntry::Init()
    throw(jme::BoxEntryEx ){
    try{
        entry = Gtk::manage(new Gtk::Entry());
    }catch(...){
        jme::BoxEntryEx e( mem_alloc, FILE, METHOD, LINE );
        e.record("error_log.txt");
        throw e;
    }
    // this->set_spacing(0);
    // Display the box with a frame
    entry->set_has_frame( true );
    entry->set_visibility( true );
    // This value is overridden by the user
    entry->set_max_length(30);

    // The size of the widget
    this->ensure_style();
    
}
/////////////////////// ComboBox ///////////////////////////
void jme::ComboBox::Init()
throw(jme::BoxEntryEx ){
    try{
        combo_box = Gtk::manage(new Gtk::ComboBoxEntryText());
    }catch(...){
        jme::BoxEntryEx e( mem_alloc, FILE, METHOD, LINE );
        e.record("error_log.txt");
        throw e;
    }
  this->add(*label);
  this->add(*combo_box);
}
jme::ComboBox::ComboBox(const gchar* title, gint pad)
throw(jme::BoxEntryEx ){
   Init();
   setTitle(title);
// === <> ===
//   this->set_size_request (10,    //width_pixels
//                           10);  //height_pixels);
   combo_box->set_size_request(10,1); //<< this does not work either
}
 
* You cannot exercise your power to a point of humiliation.
- Jean Chretien

* It's amazing how the small seeds of distrust and misunderstanding
can yield a crop of hate and death...

* If that document has fine printing anywhere, just chuck it in the garbage
- Jorge Escalante
Ma'assalama! Adiós! bye!

Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com

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