Re: GtkD button size
On Monday, 4 February 2013 at 21:55:24 UTC, Mike Wey wrote: On 02/04/2013 03:03 PM, SaltySugar wrote: On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote: On 02/03/13 16:53, SaltySugar wrote: GTKD. Can someone explain me how to change button size in vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks. Try playing with an interactive gui tool, such as glade. The fill, expand and size request interactions will be immediately visible. artur I'm waiting other answers :) A VBox or A HBox will always expand the Widget in the direction opposite of the on it's managing, if it expands the Widget in that direction depends on the options passed to packStart. So get the size request to work with those containers you'll have to wrap a HBox in a VBoc or visa versa. A more convenient container would be the ButtonBox which doesn't expand the Button in the direction it's not managing. And thus properly handles the size request. A Grid or Table might also apply depending on the complete layout. I can't find any tutorials about buttonboxes. Can you write how to use it?
Re: GtkD button size
On 02/05/2013 06:33 PM, SaltySugar wrote: I can't find any tutorials about buttonboxes. Can you write how to use it? Here is a small example: import gtk.MainWindow; import gtk.Button; import gtk.Main; import gtk.HButtonBox; class Application : MainWindow { this() { super(GtkD App); setDefaultSize(200, 200); HButtonBox hBox = new HButtonBox(); Button btnLog = new Button(Login); btnLog.setSizeRequest (70, 50); hBox.packStart(btnLog, false, false, 3); add(hBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } It looks like this: http://i45.tinypic.com/msivb4.png -- Mike Wey
Re: GtkD button size
On Tuesday, 5 February 2013 at 19:31:01 UTC, Mike Wey wrote: On 02/05/2013 06:33 PM, SaltySugar wrote: I can't find any tutorials about buttonboxes. Can you write how to use it? Here is a small example: import gtk.MainWindow; import gtk.Button; import gtk.Main; import gtk.HButtonBox; class Application : MainWindow { this() { super(GtkD App); setDefaultSize(200, 200); HButtonBox hBox = new HButtonBox(); Button btnLog = new Button(Login); btnLog.setSizeRequest (70, 50); hBox.packStart(btnLog, false, false, 3); add(hBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } It looks like this: http://i45.tinypic.com/msivb4.png Thank you, Mike. One more question. Can I use hbox.add(btn); instead of hbox.packStart (btn,false,false,5); What difference between them? Sorry, for my bad English.
Re: GtkD button size
On 2013-02-05 20:48, SaltySugar wrote: Can I use hbox.add(btn); instead of hbox.packStart (btn,false,false,5); What difference between them? Using add(btn) you would probably end up with a stretched button again. :) hbox.packStart(child, expand, fill, padding) It was explicitly said that expand = false, to prevent button resizing. Read more here: http://www.mono-project.com/GtkSharp:_Packing_with_Boxes It's Gtk# but may be of some help to you.
Re: GtkD button size
On 02/05/2013 08:48 PM, SaltySugar wrote: Thank you, Mike. One more question. Can I use hbox.add(btn); instead of hbox.packStart (btn,false,false,5); What difference between them? Sorry, for my bad English. hbox.add would call packStart with the defaults, witch would be packStart(btn, true, true, 0); Changing packStart to add in the small example i posted it appears to stay the same. -- Mike Wey
Re: GtkD button size
On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote: On 02/03/13 16:53, SaltySugar wrote: GTKD. Can someone explain me how to change button size in vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks. Try playing with an interactive gui tool, such as glade. The fill, expand and size request interactions will be immediately visible. artur I'm waiting other answers :)
Re: GtkD button size
On 02/04/2013 03:03 PM, SaltySugar wrote: On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote: On 02/03/13 16:53, SaltySugar wrote: GTKD. Can someone explain me how to change button size in vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks. Try playing with an interactive gui tool, such as glade. The fill, expand and size request interactions will be immediately visible. artur I'm waiting other answers :) A VBox or A HBox will always expand the Widget in the direction opposite of the on it's managing, if it expands the Widget in that direction depends on the options passed to packStart. So get the size request to work with those containers you'll have to wrap a HBox in a VBoc or visa versa. A more convenient container would be the ButtonBox which doesn't expand the Button in the direction it's not managing. And thus properly handles the size request. A Grid or Table might also apply depending on the complete layout. -- Mike Wey
Re: GtkD button size
On 02/03/13 16:53, SaltySugar wrote: GTKD. Can someone explain me how to change button size in vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks. Try playing with an interactive gui tool, such as glade. The fill, expand and size request interactions will be immediately visible. artur