digitalmars.D.learn - gtkD GUI design
- SaltySugar (50/50) Jan 31 2013 I want to do a GUI like this:
- SaltySugar (6/56) Jan 31 2013 Links not working.
- SaltySugar (1/64) Jan 31 2013
- SaltySugar (1/66) Jan 31 2013
- FG (5/23) Jan 31 2013 You'd need vBox.setBorderWidth(8) or similar to add space around window ...
- SaltySugar (3/32) Jan 31 2013 Thanks, setBorderWidth() is working but button's size isn't
- FG (50/51) Jan 31 2013 I don't have a working gtk environment to test it, but try this:
- SaltySugar (5/39) Jan 31 2013 I have two more questions;
- FG (5/9) Jan 31 2013 This has already been asked in this list.
- Johannes Pfau (6/14) Jan 31 2013 I'd recommend using glade and gtk.Builder unless you have a got reason
I want to do a GUI like this: http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg But I've got the following result: http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg My Code: import gtk.MainWindow; import gtk.Label; import gtk.Button; import gtk.VBox; import gtk.HBox; import gtk.Entry; import gtk.Main; class Application : MainWindow { this() { super("GtkD App"); setDefaultSize(200, 200); HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } Thanks.
Jan 31 2013
On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:I want to do a GUI like this: http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg But I've got the following result: http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg My Code: import gtk.MainWindow; import gtk.Label; import gtk.Button; import gtk.VBox; import gtk.HBox; import gtk.Entry; import gtk.Main; class Application : MainWindow { this() { super("GtkD App"); setDefaultSize(200, 200); HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } Thanks.Links not working. My current: [URL=http://www.part.lt/perziura/f4a238595048be7c23655b02477aabd8447.jpg][IMG]http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg[/IMG][/URL] I want to like that: [URL=http://www.part.lt/perziura/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg][IMG]http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg[/IMG][/URL]
Jan 31 2013
On Thursday, 31 January 2013 at 11:41:52 UTC, SaltySugar wrote:On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:I want to do a GUI like this: http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg But I've got the following result: http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg My Code: import gtk.MainWindow; import gtk.Label; import gtk.Button; import gtk.VBox; import gtk.HBox; import gtk.Entry; import gtk.Main; class Application : MainWindow { this() { super("GtkD App"); setDefaultSize(200, 200); HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } Thanks.Links not working. My current: http://www.part.lt/perziura/f4a238595048be7c23655b02477aabd8447.jpg I want to like that: http://www.part.lt/perziura/f44e209eb2ccbc9dda2e6b11fa5c6317667.jpg
Jan 31 2013
On Thursday, 31 January 2013 at 11:43:14 UTC, SaltySugar wrote:On Thursday, 31 January 2013 at 11:41:52 UTC, SaltySugar wrote:On Thursday, 31 January 2013 at 11:38:42 UTC, SaltySugar wrote:I want to do a GUI like this: http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg But I've got the following result: http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg My Code: import gtk.MainWindow; import gtk.Label; import gtk.Button; import gtk.VBox; import gtk.HBox; import gtk.Entry; import gtk.Main; class Application : MainWindow { this() { super("GtkD App"); setDefaultSize(200, 200); HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); } Thanks.Links not working. My current: http://imageshack.us/photo/my-images/33/16969673.png/ I want to do like that: http://imageshack.us/photo/my-images/831/wantedjn.png/
Jan 31 2013
On 2013-01-31 12:38, SaltySugar wrote:HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll();You'd need vBox.setBorderWidth(8) or similar to add space around window borders and to keep the button from taking up all available width I think you will have to put btnLog inside a HBox first and then add that HBox to the vBox. (haven't checked any of this myself)
Jan 31 2013
On Thursday, 31 January 2013 at 12:21:55 UTC, FG wrote:On 2013-01-31 12:38, SaltySugar wrote:Thanks, setBorderWidth() is working but button's size isn't changing.HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll();You'd need vBox.setBorderWidth(8) or similar to add space around window borders and to keep the button from taking up all available width I think you will have to put btnLog inside a HBox first and then add that HBox to the vBox. (haven't checked any of this myself)
Jan 31 2013
On 2013-01-31 13:35, SaltySugar wrote:Thanks, setBorderWidth() is working but button's size isn't changing.I don't have a working gtk environment to test it, but try this: (maybe hBox2 isn't even needed and you could vBox.add(algn1);) import gtk.MainWindow; import gtk.Label; import gtk.Button; import gtk.VBox; import gtk.HBox; import gtk.Entry; import gtk.Main; import gtk.Alignment; class Application : MainWindow { this() { super("GtkD App"); setDefaultSize(200, 200); HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); // Alignment(xalign, yalign, xscale, yscale) // xscale = 0 stops the child from stretching in X axis Alignment algn1 = new Alignment(0.5, 0, 0, 0); HBox hBox2 = new HBox(false, 3); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); vBox.setBorderWidth(8); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); algn1.add (btnLog); hBox2.add (algn1); vBox.add (hBox2); add(vBox); showAll(); } } void main(string[] args) { Main.init(args); new Application(); Main.run(); }
Jan 31 2013
On Thursday, 31 January 2013 at 12:35:44 UTC, SaltySugar wrote:On Thursday, 31 January 2013 at 12:21:55 UTC, FG wrote:I have two more questions; First, how to remove an arrow on the window's bottom? Second, when I run my program it runs together with console. I want to run only window of application. How to do it?On 2013-01-31 12:38, SaltySugar wrote:Thanks, setBorderWidth() is working but button's size isn't changing.HBox hBox = new HBox(false, 3); HBox hBox1 = new HBox(false, 3); VBox vBox = new VBox(false, 5); Button btnLog = new Button("LOGIN --->"); Label lblNick = new Label("User: "); Entry txtNick = new Entry(); Label lblPass = new Label("Password: "); Entry txtPass = new Entry(); btnLog.setSizeRequest(70, 30); vBox.packStart(hBox, true, true, 3); vBox.packStart(hBox1, true, true, 3); hBox.add (lblNick); hBox.add (txtNick); hBox1.add (lblPass); hBox1.add (txtPass); vBox.add (btnLog); add(vBox); showAll();You'd need vBox.setBorderWidth(8) or similar to add space around window borders and to keep the button from taking up all available width I think you will have to put btnLog inside a HBox first and then add that HBox to the vBox. (haven't checked any of this myself)
Jan 31 2013
On 2013-01-31 14:33, SaltySugar wrote:I have two more questions; First, how to remove an arrow on the window's bottom?By making the window fixed-size, not scalable?Second, when I run my program it runs together with console. I want to run only window of application. How to do it?This has already been asked in this list. Apparently you have to compile like this: dmd.exe -L/SUBSYSTEM:WINDOWS app.d
Jan 31 2013
Am Thu, 31 Jan 2013 12:38:41 +0100 schrieb "SaltySugar" <Butkustomas777 gmail.com>:I want to do a GUI like this: http://www.part.lt/img/f44e209eb2ccbc9dda2e6b11fa5c6317747.jpg But I've got the following result: http://www.part.lt/img/f4a238595048be7c23655b02477aabd8447.jpg Thanks.I'd recommend using glade and gtk.Builder unless you have a got reason for not using it ;-) http://gtkd.mikewey.eu/src/gtk/Builder.html https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
Jan 31 2013