gtk - gtkmm button not maintaining size and location -


i have created 2 gtkmm button , added hbox object. called pack_end, , maintained size 21,20. but, sizes not maintained. here code have written , window got while running program.

alt text

note: mywindow subclass of gtk::window

void mywindow::customizetitlebar() { //create vertical box gtk::vbox *vbox = new gtk::vbox(false,0);

//create horizontal box gtk::hbox *hbox = new gtk::hbox(true,0); hbox->set_border_width(5);  //create title bar image gtk::image *titlebarimage = new gtk::image("src/windowtitlebar.png"); titlebarimage->set_alignment(gtk::align_left); 

// hbox->pack_start(*titlebarimage,gtk::pack_expand_widget,0);

//create cloze button window mbuttonclose = new gtk::button; (*mbuttonclose).set_size_request(21,20); gtk::image *mimage =  new gtk::image("src/maximize.jpeg"); (*mbuttonclose).add(*mimage); (*mbuttonclose).set_image_position(gtk::pos_top);  // connecting close window function when cliked on close button  //(*mbuttonclose).signal_clicked().connect( sigc::mem_fun(this, &mywindow::closewindow));  hbox->pack_end(*mbuttonclose,gtk::pack_expand_widget,0); gtk::button * mbtton = new gtk::button; mbtton->set_size_request(21,20); gtk::image *img =  new gtk::image("src/maximize.jpeg"); mbtton->add(*img); mbtton->set_image_position(gtk::pos_top);  hbox->pack_end(*mbtton,gtk::pack_expand_widget,0);  vbox->add(*hbox);  //drawing area box gtk::hbox *hboxdrawingarea = new gtk::hbox;  gtk::drawingarea *mdrawingarea = new gtk::drawingarea;  hboxdrawingarea->pack_start(*mdrawingarea,gtk::pack_expand_widget,0);  vbox->add(*hboxdrawingarea);  //status bar hbox gtk::hbox *hboxstatusbar = new gtk::hbox;  vbox->add(*hboxstatusbar);  this->add(*vbox);  this->show_all(); 

}

i not yet gtk expert (but i'm learning), here's 1 thing can try, i've been doing. make little standalone project using glade. glade makes easy screw around packing settings can see effects of changes. think in case of resizing window, you'll have save glade file , run program (using gtkbuilder render glade file) , manually resize window see effect, once make standalone project, can use other gtk testing. , if you're me, you'll swayed wonderfulness glade , build whole system way.

but basically, sounds packing issue, because i've got buttons don't resize on place. not moving, i'm not sure can that, again i'm not expert. think should able pin size of if not of hbox pieces button inside them not move, i'm not sure happens if don't have hbox parts can't variably sized take slack when grow window.

again, sounds fun try in glade. :-)


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -