Re: GUI library for DMD 2.090 or DMD 2.091
On Mon, 2020-04-27 at 12:12 +, Antonio Corbi via Digitalmars-d-learn wrote: > On Monday, 27 April 2020 at 11:27:57 UTC, Paulo Pinto wrote: > > On Sunday, 26 April 2020 at 09:09:04 UTC, Antonio Corbi wrote: […] > > > I don't know if you are referring to the `clone!` macro > > > described here[1] > > > > > > [1] https://gtk-rs.org/blog/2019/12/15/new-release.html > > > > > > Antonio > > > > Hi, this macro is new to me, it did not exist when I tried to > > have a go at Gtk-rs, so it simplifies not having to write such > > boilerplate ourselves, but like the author mentions it doesn't > > make it go away, it just gets hidden behind the macro. > > Hi, > > Yes, previously this macro lived (in a simplified form, i.e. no > @strong) in the examples provided by the gtk-rs developers. Now > it's part of the gtk-rs bindings. I have not found any real need to use that clone! macro. I have found it straightforward, and easy, to clone the variables required so they can be moved. It also seems self-documenting, making the cloning obvious. -- 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
Re: GUI library for DMD 2.090 or DMD 2.091
On Monday, 27 April 2020 at 11:27:57 UTC, Paulo Pinto wrote: On Sunday, 26 April 2020 at 09:09:04 UTC, Antonio Corbi wrote: On Saturday, 25 April 2020 at 09:30:44 UTC, Paulo Pinto wrote: On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: [...] Just curious, how do you handle the whole RC> story in Gtk-rs? For me it made the point that languages with tracing GC or implicit reference counting are much better solution for doing GUI programming. Hi Paulo, I don't know if you are referring to the `clone!` macro described here[1] [1] https://gtk-rs.org/blog/2019/12/15/new-release.html Antonio Hi, this macro is new to me, it did not exist when I tried to have a go at Gtk-rs, so it simplifies not having to write such boilerplate ourselves, but like the author mentions it doesn't make it go away, it just gets hidden behind the macro. Hi, Yes, previously this macro lived (in a simplified form, i.e. no @strong) in the examples provided by the gtk-rs developers. Now it's part of the gtk-rs bindings. Antonio
Re: GUI library for DMD 2.090 or DMD 2.091
On Sunday, 26 April 2020 at 09:09:04 UTC, Antonio Corbi wrote: On Saturday, 25 April 2020 at 09:30:44 UTC, Paulo Pinto wrote: On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: [...] Just curious, how do you handle the whole RC> story in Gtk-rs? For me it made the point that languages with tracing GC or implicit reference counting are much better solution for doing GUI programming. Hi Paulo, I don't know if you are referring to the `clone!` macro described here[1] [1] https://gtk-rs.org/blog/2019/12/15/new-release.html Antonio Hi, this macro is new to me, it did not exist when I tried to have a go at Gtk-rs, so it simplifies not having to write such boilerplate ourselves, but like the author mentions it doesn't make it go away, it just gets hidden behind the macro.
Re: GUI library for DMD 2.090 or DMD 2.091
On Saturday, 25 April 2020 at 09:30:44 UTC, Paulo Pinto wrote: On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: [...] Just curious, how do you handle the whole RC> story in Gtk-rs? For me it made the point that languages with tracing GC or implicit reference counting are much better solution for doing GUI programming. Hi Paulo, I don't know if you are referring to the `clone!` macro described here[1] [1] https://gtk-rs.org/blog/2019/12/15/new-release.html Antonio
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! working GUI library for D: Gtkd and tkd. --- dbh.
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! Here is everything you need to know: https://madscientisthaven.blogspot.com/2020/01/beginning-multimedia-with-arsd.html
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 can create easy GUI using Qt or Win32Api. See step-by-step easy vides: GUI Qt: https://www.youtube.com/watch?v=Es9Qs9_1ipk GUI Win32Api: https://www.youtube.com/watch?v=_QqyPTLbgHU
Re: GUI library for DMD 2.090 or DMD 2.091
On Sat, 2020-04-25 at 09:30 +, Paulo Pinto via Digitalmars-d-learn wrote: […] > > Just curious, how do you handle the whole RC> story in > Gtk-rs? > > For me it made the point that languages with tracing GC or > implicit reference counting are much better solution for doing > GUI programming. > I am still not sure I have truly come to terms with the whole Rc/Arc and RefCell stuff. It isn't so much the using them, it is trying to decide what is the right combination for a given situation. Big D win here due to garbage collection. -- 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
Re: GUI library for DMD 2.090 or DMD 2.091
On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote: 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. Just curious, how do you handle the whole RC> story in Gtk-rs? For me it made the point that languages with tracing GC or implicit reference counting are much better solution for doing GUI programming.
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
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 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 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 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.