www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GUI library for DMD 2.090 or DMD 2.091

reply Phrozen <nediko abv.bg> writes:
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!
Apr 24 2020
next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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.
Apr 24 2020
parent reply Phrozen <nediko abv.bg> writes:
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!
Apr 24 2020
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
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.
Apr 24 2020
prev sibling parent reply Russel Winder <russel winder.org.uk> writes:
On Fri, 2020-04-24 at 15:50 +0000, Phrozen via Digitalmars-d-learn
wrote:
=20
[=E2=80=A6]
  Basile B., thanks for the suggestion. I'll try this library too.
=20
Just a bit of confirmation: I am a fan of D and GtkD for desktop UI work.=20 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 =E2=80=93 which is the same between GTK+ and Qt. Qt i= s 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. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Apr 24 2020
parent reply Paulo Pinto <pjmlp progtools.org> writes:
On Friday, 24 April 2020 at 18:52:55 UTC, Russel Winder wrote:
 On Fri, 2020-04-24 at 15:50 +0000, 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<RefCell<>> 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.
Apr 25 2020
next sibling parent Russel Winder <russel winder.org.uk> writes:
On Sat, 2020-04-25 at 09:30 +0000, Paulo Pinto via Digitalmars-d-learn
wrote:
[=E2=80=A6]
=20
 Just curious, how do you handle the whole RC<RefCell<>> story in=20
 Gtk-rs?
=20
 For me it made the point that languages with tracing GC or=20
 implicit reference counting are much better solution for doing=20
 GUI programming.
=20
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. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Apr 25 2020
prev sibling parent reply Antonio Corbi <antonio ggmail.com> writes:
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<RefCell<>> 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
Apr 26 2020
parent reply Paulo Pinto <pjmlp progtools.org> writes:
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<RefCell<>> 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.
Apr 27 2020
parent reply Antonio Corbi <acrb ggmail.com> writes:
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<RefCell<>> 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
Apr 27 2020
parent Russel Winder <russel winder.org.uk> writes:
On Mon, 2020-04-27 at 12:12 +0000, 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:
[=E2=80=A6]
 I don't know if you are referring to the `clone!` macro=20
 described here[1]
=20
 [1] https://gtk-rs.org/blog/2019/12/15/new-release.html
=20
 Antonio
=20 Hi, this macro is new to me, it did not exist when I tried to=20 have a go at Gtk-rs, so it simplifies not having to write such=20 boilerplate ourselves, but like the author mentions it doesn't=20 make it go away, it just gets hidden behind the macro.
=20 Hi, =20 Yes, previously this macro lived (in a simplified form, i.e. no=20 strong) in the examples provided by the gtk-rs developers. Now=20 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. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
May 11 2020
prev sibling next sibling parent Basile B. <b2.temp gmx.com> writes:
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/
Apr 24 2020
prev sibling next sibling parent Marcone <marcone email.com> writes:
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
Apr 25 2020
prev sibling next sibling parent Murilo <murilomiranda92 hotmail.com> writes:
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
Apr 25 2020
prev sibling parent dangbinghoo <dangbinghoo gmail.com> writes:
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.
Apr 26 2020