Gtk::Bin::set_justify(Left)??



namespace jme {
class Testing64bitVariables : virtual public Gtk::Window {
public:
    Testing64bitVariables();
    virtual ~Testing64bitVariables();

protected:
Gtk::VBox* vbBase;             //Houses vbFrame and hb h_btnButtons
Gtk::VBox* vbFrame;            //Since Gtk::Frame is a single-item container, vbFrame will hold all the widgets that will be inside the frmOne
Gtk::Frame* frmOne;            //Frame holds all the widgets, except Quite Button
Gtk::ButtonBox* h_btnButtons;  //Houses the Quit button

//Integers
Gtk::HBox* hbBaseInt;      //hbLeft and hbRight sit on top of this Box
Gtk::HBox* hbLeftInt;      //Houses lblLabelInt
Gtk::HBox* hbRightInt;     //Houses the value of the variable value
Gtk::Label* lblInt;        //Variable name
Gtk::Label* lblIntTxt;     //sizeof string value
....
};
}

===============

jme::Testing64bitVariables::Testing64bitVariables() {
    vbBase = Gtk::manage(new Gtk::VBox());
    h_btnButtons = Gtk::manage(new Gtk::HButtonBox());
    vbFrame = Gtk::manage(new Gtk::VBox());
    this->Frame();
    this->Integers();
    .......

    //Window Properties
    .....

    vbBase->pack_start(*frmOne);
    vbBase->pack_start(*h_btnButtons);
    this->add(*vbBase);

    this->show_all_children();
}
====
jme::error_t jme::Testing64bitVariables::Frame() {
    frmOne = Gtk::manage(new Gtk::Frame("Variable Types"));
    //Add style and widget to the window Frame
    frmOne->set_shadow_type(Gtk::SHADOW_ETCHED_IN );
    frmOne->add(*vbFrame);
    return jme::good;
}
====

jme::error_t jme::Testing64bitVariables::Integers() {
    lblInt  = Gtk::manage(new Gtk::Label());
    lblInt->set_justify (Gtk::JUSTIFY_LEFT);
    int i = sizeof(int);
    Glib::ustring txt = str_tool.toStr(i);
    lblInt->set_text(txt);

    lblIntTxt = Gtk::manage(new Gtk::Label());
    {
        lblIntTxt->set_text("int");
        lblIntTxt->set_justify(Gtk::JUSTIFY_LEFT);
    }
    hbBaseInt  = Gtk::manage(new Gtk::HBox());
    hbLeftInt  = Gtk::manage(new Gtk::HBox());
    {
        hbLeftInt->set_border_width(10);
    }
    hbRightInt = Gtk::manage(new Gtk::HBox());

    //Add widgets to the Horizontal Box
    hbLeftInt->pack_start(*lblInt);
    hbRightInt->pack_start(*lblIntTxt);

    hbBaseInt->set_homogeneous( true );
    hbBaseInt->pack_start(*hbRightInt);
    hbBaseInt->pack_start(*hbLeftInt);

    //Add widgets to vbBase
    vbFrame->pack_start(*hbBaseInt);
    return jme::good;
}


In the snip above I have tried to demonstrate the necessary code to understand how this simple program works and I have attached a 'png' file that shows the output as well as a 'dia' file to visually demonstrate what is each of the objects hosting. In the output you can see that the displayed strings are centered in their respective boxes. However, I would like them to be shifted to the left of the box, thus I tried '
lblIntTxt->set_justify(Gtk::JUSTIFY_LEFT);', but to no avail. I then tried left shifting the 'hbBaseInt', but, AFAIK, Gtk::HBox neither have nor inherit a method that does the left shifting.
Does anyone know how to, in the above example, shift the variable-name to the left and the variable-size to the right?

TIA

Attachment: Testing 64bit Variables.png
Description: PNG image

Attachment: Testing64bitVariables.dia
Description: application/dia



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