digitalmars.D.learn - starting with GUI
I;m trying to add a Entry but I get the following error: "mywindow.d(12): Error: undefined identifier Entry" Here is my code : "window.add(new Entry("Minsit"));" I'm just guessing to see if everything is that simple. So I have to define the Entry. How do I do that ? ( Any tutorials from the web are welcome ) I'm trying to make a program that calculates two numbers and then adds them together to give a result. Here is the CLI version : " import std.stdio; import std.c.stdlib; void main() { immutable sitc = 1.66, sleepc = 1.08; float tcsleep, tcsit, tc; int minsleep, minsit; write("Input number of minutes sleep and sit : \n"); readf(" %s ", &minsleep); readf(" %s ", &minsit); write("Thanks!\n"); tcsit = minsleep*sleepc; tcsleep = minsit*sitc; tc = (tcsleep + tcsit); writeln("Your total burned calories is : ", tc); } " I'm using this GTK for the GUI : "http://www.dsource.org/projects/gtkd/wiki/DebianPackages" and this compiles fine with the following : "dmd $(pkg-config --cflags --libs gtkd-2) mywindow.d" This is the code I compiled with GTKD : " import gtk.MainWindow; import gtk.Label; import gtk.Main; void main (string[] args) { Main.init(args); auto window = new MainWindow("My Window"); window.show(); window.setDefaultSize(200, 100); window.add(new Label("Hello!")); window.showAll(); Main.run; } " So basicly what I'm missing is a good way on learning to use this GTKD but for the moment I only want to define a Entry. THank you for your time.
Apr 30 2013
Another version of the CLI which tries to keep 1440 minutes for a complete day ( this is desired on the GUI ) is : " import std.stdio; import std.c.stdlib; void main() { immutable sitc = 1.66; immutable sleepc = 1.08; float tcsleep, tcsit, tc; int minsleep, minsit; write("Input minutes sit : \n"); readf(" %d", &minsit); write("Input minutes sleep : \n"); readf(" %d", &minsleep); while (minsit+minsleep != 1440){ write("Error 1 \n"); write("Input minutes sit : \n"); readf(" %d", &minsit); write("Input minutes sleep : \n"); readf(" %d", &minsleep); } if (minsit+minsleep == 1440){ tcsit = minsleep*sleepc; tcsleep = minsit*sitc; tc = (tcsleep + tcsit); write("Your calories per day is : ", tc, "\n"); exit (0); } } "
Apr 30 2013
On Tuesday, 30 April 2013 at 17:03:07 UTC, Carlos wrote:I;m trying to add a Entry but I get the following error: "mywindow.d(12): Error: undefined identifier Entry" Here is my code : "window.add(new Entry("Minsit"));" I'm just guessing to see if everything is that simple. So I have to define the Entry. How do I do that ? ( Any tutorials from the web are welcome )[...]This is the code I compiled with GTKD : " import gtk.MainWindow; import gtk.Label; import gtk.Main; void main (string[] args) { Main.init(args); auto window = new MainWindow("My Window"); window.show(); window.setDefaultSize(200, 100); window.add(new Label("Hello!")); window.showAll(); Main.run; } " So basicly what I'm missing is a good way on learning to use this GTKD but for the moment I only want to define a Entry. THank you for your time.A wild guess: import gtk.Entry;
Apr 30 2013
A wild guess: import gtk.Entry;Thank you I just did that some minutes ago ( a good guess ). Now I'm trying to work on the layout so I can finally enter in signals if that's how GTKD works.
Apr 30 2013
On Tuesday, 30 April 2013 at 17:36:37 UTC, Carlos wrote:For anyone interested in what I'm doing here is a link to some code samples found in another forum. I'l be checking them tomorrow and if that leads me to my own GUI I'll be posting the code here so anyone can learn from me. Cheers! link : http://www.dsource.org/projects/gtkd/wiki/CodeExamplesA wild guess: import gtk.Entry;Thank you I just did that some minutes ago ( a good guess ). Now I'm trying to work on the layout so I can finally enter in signals if that's how GTKD works.
May 01 2013