GUI library for DMD 2.090 or DMD 2.091
I'm too new to DLang and I have a lot to learn. Probably that's why I have a lot of difficulties. Has anyone tried using a GUI library to the latest DMD 2.090 or DMD 2.091? I plan to use this language for a specific Thermal calculator application for Windows, but for two days I've been struggling with dub and elementary examples in GUI libraries. I need something simple - a modal window with 3 buttons and a two text boxes. So far I have tested DWT, TKD, DFL, dlangui without success. Can anyone help me with advice or some more recent tutorial. Thank you!
Re: GUI library for DMD 2.090 or DMD 2.091
On Friday, 24 April 2020 at 13:45:22 UTC, Phrozen wrote: I need something simple - a modal window with 3 buttons and a two text boxes This sounds easy with my minigui.d. My library doesn't have a lot of features, no fancy graphics, and layout can be a bit clunky... but check out this code: Well first grab the library files from here: https://github.com/adamdruppe/arsd The three files you'll need are minigui.d, simpledisplay.d, and color.d. Just download them to your directory and compile all together with your file: dmd yourfile.d minigui.d simpledisplay.d color.d and it will make yourfile.exe. To get rid of the console, add `-L/subsystem:windows` to that build command. If making a 64 bit exe, you will need -m64 and -L/entry:mainCRTStartup as well. So the total thing can be: dmd yourfile.d minigui.d simpledisplay.d color.d -L/subsystem:windows -L/entry:mainCRTStartup -m64 And that will create your stand-alone Windows exe that does not have a console, just the gui window. Here's a screenshot: http://arsdnet.net/calc.png The library also works on Linux but it is quirky there since it is 100% DIY. It has no Mac support at all right now. But if all you need is basic building blocks on Windows, it should be OK. Anyway, the code, I hope is is kinda self-explanatory or at least you can try poking around and see changes yourself. If not let me know and I'll write more here. --- import arsd.minigui; class CustomSpacer : Widget { this(Widget parent) { super(parent); } override int paddingLeft() { return 32; } override int paddingRight() { return 32; } override int paddingTop() { return 32; } override int paddingBottom() { return 32; } } void main() { auto window = new Window(400, 180, "My Calculator"); auto spacer = new CustomSpacer(window); auto box1 = new LabeledLineEdit("Fahrenheit: ", spacer); auto box2 = new LabeledLineEdit("Celsius: ", spacer); new VerticalSpacer(spacer); auto layout = new class HorizontalLayout { this() { super(spacer); } override int maxHeight() { return 40; } }; auto button1 = new Button("F to C", layout); auto button2 = new Button("C to F", layout); auto button3 = new Button("Close", layout); button1.addEventListener(EventType.triggered, delegate () { import std.conv; import std.format; try { auto f = to!float(box1.content); auto c = (f - 32) / 1.8; box2.content = format("%0.2f", c); } catch(Exception e) { messageBox("Exception", e.msg); } }); button2.addEventListener(EventType.triggered, delegate () { import std.conv; import std.format; try { auto c = to!float(box2.content); auto f = c * 1.8 + 32; box1.content = format("%0.2f", f); } catch(Exception e) { messageBox("Exception", e.msg); } }); button3.addEventListener(EventType.triggered, delegate() { window.close(); }); window.loop(); } --- I wrote some docs for the lib here but it is incomplete. http://dpldocs.info/experimental-docs/arsd.minigui.html It is also possible to use my library with dub https://code.dlang.org/packages/arsd-official It is the "arsd-official:minigui" subpackage there. But I think it is easier to just download the file yourself and build it since it doesn't have a fancy build system.
Re: GUI library for DMD 2.090 or DMD 2.091
On Friday, 24 April 2020 at 13:45:22 UTC, Phrozen wrote: I'm too new to DLang and I have a lot to learn. Probably that's why I have a lot of difficulties. Has anyone tried using a GUI library to the latest DMD 2.090 or DMD 2.091? I plan to use this language for a specific Thermal calculator application for Windows, but for two days I've been struggling with dub and elementary examples in GUI libraries. I need something simple - a modal window with 3 buttons and a two text boxes. So far I have tested DWT, TKD, DFL, dlangui without success. Can anyone help me with advice or some more recent tutorial. Thank you! you also have GTK-D[1], and you have up to date sources to learn[2] it. [1] https://code.dlang.org/packages/gtk-d [2] https://gtkdcoding.com/
Re: GUI library for DMD 2.090 or DMD 2.091
On Friday, 24 April 2020 at 14:13:25 UTC, Adam D. Ruppe wrote: On Friday, 24 April 2020 at 13:45:22 UTC, Phrozen wrote: [...] This sounds easy with my minigui.d. My library doesn't have a lot of features, no fancy graphics, and layout can be a bit clunky... but check out this code: [...] @Adam D. Ruppe, your idea is great, especially for small and unpretentious applications! Very good work, man! @Basile B., thanks for the suggestion. I'll try this library too. Thank you both, guys! Be healthy!
Re: GUI library for DMD 2.090 or DMD 2.091
On Friday, 24 April 2020 at 15:50:15 UTC, Phrozen wrote: @Adam D. Ruppe, your idea is great, especially for small and unpretentious applications! Very good work, man! if you do decide to use my thingy let me know how it goes for you. I often don't recommend it in threads cuz it kinda sucks, but I just think your use case sounded like a good fit.
Re: GUI library for DMD 2.090 or DMD 2.091
On Fri, 2020-04-24 at 15:50 +, Phrozen via Digitalmars-d-learn wrote: > […] > @Basile B., thanks for the suggestion. I'll try this library too. > Just a bit of confirmation: I am a fan of D and GtkD for desktop UI work. GTK+ is just a UI framework unlike Qt (which is UI and networking, database, etc.) and is fairly straightforward to work with after the initial learning hump – which is the same between GTK+ and Qt. Qt is really C++ and Python only though many languages have bindings to QML. GTK+ has many bindings, C++, Go, Rust, and D to name just the obvious native code languages. C++ (gtkmm) and Go (gotk3) bindings are manuals ones, Rust (gtk-rs) and D (GtkD) bindings are generated from the API specification (GIR files). I believe this makes gtk-rs and GtkD far superior to gtkmm and gotk3. I have done a number of projects in Rust/gtk-rs and D/GtkD. Overall I prefer the code of D/GtkD over Rust/gtk-rs *but* there is much more IDE and editor support for Rust compared to D. This makes Rust code easier to write than the equivalent D code, even if that Rust code is more ugly than the equivalent D code. So whilst I keep wanting to do D/GtkD, I keep getting pulled to Rust/gtk-rs simply because CLion (and Emacs) support for Rust is so much nicer than the D support. I must laud Samael's efforts on the IntelliJ IDEA/CLion D support, it is magnificent, but the project needs more resource to get the CLion D plugin somewhere near as good as the Rust CLion plugin. I am sure VisualStudio fans, indeed any other IDE users, will say the same about their IDE, I am a CLion user so try to push CLion support. -- Russel. === Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
DConf 2017 Videos
Hi, please could someone tell me where can I find videos from DConf 2017? I pretty sure I watched them on Youtube sometime ago, but I can't find anymore. By the way, I'm looking from one video where someone shows some "C flaws" and how to D as Better C could solve that. I think it was the second talk in this list: https://dconf.org/2017/schedule/ Any idea? Thanks.
Re: DConf 2017 Videos
On 4/24/20 4:24 PM, matheus wrote: Hi, please could someone tell me where can I find videos from DConf 2017? I pretty sure I watched them on Youtube sometime ago, but I can't find anymore. By the way, I'm looking from one video where someone shows some "C flaws" and how to D as Better C could solve that. I think it was the second talk in this list: https://dconf.org/2017/schedule/ Any idea? Thanks. Can't find the post, but Sociomantic is no longer, and whomever controlled the sociomantic youtube account took down all the videos. Last I heard they were trying to figure out if they could get the videos back up. -Steve
Re: DConf 2017 Videos
On Friday, 24 April 2020 at 21:11:48 UTC, Steven Schveighoffer wrote: ... and whomever controlled the sociomantic youtube account took down all the videos... First of all thanks for replying and... Ouch! After that I hope D Foundation learned the lesson and keep the videos themselves instead of relying in third party next time. I think it's time to have a Wayback Machine version for videos. Thanks.
What is the best way to refer to itself when obtaining Substring of a literal?
I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]);
Re: What is the best way to refer to itself when obtaining Substring of a literal?
On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]); no way
Re: What is the best way to refer to itself when obtaining Substring of a literal?
On Saturday, 25 April 2020 at 01:32:54 UTC, 9il wrote: On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]); no way alias Seq = AliasSeq!("Hello Word!"); // it isn't a variable, lambda or enum writeln(Seq[0][Seq[0].indexOf(" "), $]); looks weird anyway
Re: DConf 2017 Videos
On Friday, 24 April 2020 at 21:25:11 UTC, matheus wrote: On Friday, 24 April 2020 at 21:11:48 UTC, Steven Schveighoffer wrote: ... and whomever controlled the sociomantic youtube account took down all the videos... First of all thanks for replying and... Ouch! After that I hope D Foundation learned the lesson and keep the videos themselves instead of relying in third party next time. 2017 was the last time the Foundation did not obtain copies of the videos. The YouTube channel started in 2018 and from that time and on into the future the Foundation has hosted and will host all of the DConf videos. And we'll soon have our own copies of all of the 2015 videos in case the UVU channel goes away some day. I think it's time to have a Wayback Machine version for videos. A few of the 2013/14 videos are in the Internet Archive. They have to be uploaded manually. Someone created a D account for it and uploaded them there at some point. When I created the Foundation's channel, I downloaded those and ripped the rest of the 2013/14 videos from various YouTube accounts, then uploaded them to our channel. So we have everything now except the 2016/17 copies.
Re: What is the best way to refer to itself when obtaining Substring of a literal?
On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]); Maybe u want this? import std.algorithm: find; import std.stdio: writeln; "Hello World".find(" ").writeln;
Re: DConf 2017 Videos
On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM, matheus wrote: > whomever controlled the sociomantic youtube account took down > all the videos. I think it's unintentional because the same thing happened to my Weka account: After I stopped working there, the company naturally deleted my account and the videos that were associated with that account disappeared from YouTube after a grace period. I think it was one month at that time but nobody was aware until it was too late. Apparently the internet can actually forget some things. :) Ali
Re: DConf 2017 Videos
On Saturday, 25 April 2020 at 04:11:02 UTC, Ali Çehreli wrote: On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM, matheus wrote: > whomever controlled the sociomantic youtube account took down > all the videos. I think it's unintentional because the same thing happened to my Weka account: After I stopped working there, the company naturally deleted my account and the videos that were associated with that account disappeared from YouTube after a grace period. I think it was one month at that time but nobody was aware until it was too late. Well, this wasn't one person's account. It was the company account. I've since learned that, as part of Dunhumby's process of killing off the Sociomantic brand, someone in their marketing department took it down without realizing that we were relying on it. To their credit, they have since tried to recover the account, but apparently by then it was too late.
Re: DConf 2017 Videos
On Saturday, 25 April 2020 at 04:11:02 UTC, Ali Çehreli wrote: On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM, matheus wrote: > whomever controlled the sociomantic youtube account took down > all the videos. I think it's unintentional because the same thing happened to my Weka account: After I stopped working there, the company naturally deleted my account and the videos that were associated with that account disappeared from YouTube after a grace period. I think it was one month at that time but nobody was aware until it was too late. Apparently the internet can actually forget some things. :) Ali Andrei was asking something similar yesterday. https://twitter.com/incomputable/status/1253342091188502528?s=19