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



On 11/8/2010 2:32 PM, Robert Pearce wrote:
Hi ArbolOne,

On Mon, 08 Nov 2010 12:37:21 -0500 you wrote:
I really don't understand why this should be a problem, it is a simple
mechanism and logical to assume that developer would use this feature.
Anyway, here is the code:
      lblIntTxt = Gtk::manage(new Gtk::Label());
      lblIntTxt->set_text("int");
      lblIntTxt->set_justify(Gtk::JUSTIFY_LEFT);
      lblIntTxt->set_alignment(Gtk::ALIGN_LEFT,Gtk::ALIGN_LEFT);
      lblIntTxt->property_xalign() = 0.0f;
OK, so you seem to have fairly comprehensively left-aligned that label.
Silly question - are you sure it's not something else that's making it
wrong? How is it packaged? Is it in a container that may pad around it?
For instance, if it's in a table, did you use Gtk::EXPAND/Gtk::FILL
when attaching it?


Rob
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

This is a extended snip.

class MyClass{
public:
        MyClass();
...

protected:
Gtk::VBox* vbBase;             //Houses vbFrame
//Gtk::VBox* vbFrame; //Since Gtk::Frame is a single-item container, vbFrame will hold all the widgets that will be inside the frmOne Gtk::Table* tblTable; //This table displays the variable name and the size of the variable
Gtk::Frame* frmOne;            //Frame holds the Table Widget

//Integers
Gtk::Label* lblInt;        //Variable name
Gtk::Label* lblIntTxt;     //sizeof string value
strtools str_tool;   //string manipulation
Glib::ustring txt;    // temp string
...
};
void MyClass::MyClass(){
 //Window Properties
    this->set_title("Testing 64bit Variables");
    this->set_size_request(250,300);
    this->set_border_width(10);

   vbBase = Gtk::manage(new Gtk::VBox());
   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(*tblTable);
 //Table and properties
  tblTable = Gtk::manage(new Gtk::Table(4,2,true));
      lblInt  = Gtk::manage(new Gtk::Label());
         lblInt->set_justify (Gtk::JUSTIFY_RIGHT);

//Left Label and properties
lblIntTxt = Gtk::manage(new Gtk::Label());
    lblIntTxt->set_text("int");
    lblIntTxt->set_justify(Gtk::JUSTIFY_LEFT);
    lblIntTxt->set_alignment(Gtk::ALIGN_LEFT,Gtk::ALIGN_LEFT);
    lblIntTxt->property_xalign() = 0.0f;

//Attach Left Label to the Table and pack it
    tblTable->attach(*lblIntTxt, 0,1,0,1,Gtk::EXPAND,Gtk::EXPAND,0,0);
    vbBase->pack_start(*tblTable);

//Right Label
    int i = sizeof(int);
txt = str_tool.toStr(i); // Convertes numerical values to a literal and returns a std::string value
    lblInt->set_text(txt);

//Attach Right Label to the Table and pack it
    tblTable->attach(*lblInt,    1,2,0,1,Gtk::EXPAND,Gtk::EXPAND,0,0);
    vbBase->pack_start(*tblTable);

// let the show begin
    vbBase->pack_start(*frmOne);
    this->add(*vbBase);
    this->show_all_children();
}
Thanks every one for your patience, I hope that the above data would be enough for you to pinpoint what I am doing wrong.
Thanks in advance.



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