www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D GUI Toolkit Comparison

reply =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Could somebody briefly outline the different GUI toolkits 
available in D and how they differ especially in terms of 
cleverly the make use of all idioms available in the language 
aswell as in Phobos.

For instance: DlangUI and Adams D Ruppe's `simpledisplay`
Apr 29 2016
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 29 April 2016 at 13:52:59 UTC, Nordlöw wrote:
 Could somebody briefly outline the different GUI toolkits 
 available in D and how they differ especially in terms of 
 cleverly the make use of all idioms available in the language 
 aswell as in Phobos.

 For instance: DlangUI and Adams D Ruppe's `simpledisplay`
simpledisplay isn't a gui toolkit really, it just does basic things like creating windows, handling events, and other associated foundation like clipboard access. You can access the native handles for it to expand though (and my minigui.d does that, but I'm still not happy with it). So simpledisplay is more like SDL than GTK. simpledisplay also makes zero effort to be clever, it is meant to be simple and tries not to use Phobos at all (avoiding phobos in a foundation library like this means faster compile times and smaller binaries if you stick to system libraries).
Apr 29 2016
prev sibling parent Gary Willoughby <dev nomad.so> writes:
On Friday, 29 April 2016 at 13:52:59 UTC, Nordlöw wrote:
 Could somebody briefly outline the different GUI toolkits 
 available in D and how they differ especially in terms of 
 cleverly the make use of all idioms available in the language 
 aswell as in Phobos.

 For instance: DlangUI and Adams D Ruppe's `simpledisplay`
https://wiki.dlang.org/GUI_Libraries I'm the author of Tkd[1] and wrote it to learn D in more depth and really enjoyed the flexibility of generic classes/functions/interfaces and mixins. Because Tkd is based on Tcl/Tk it was really hard to map the Tcl language and Tk toolkit to a sensible type hierarchy using inheritance. Using D gave me the opportunity to think a bit differently and compose types more simply while modeling the problem in a more intelligent way. I'm bias, but I love the simplicity of the finished code. A pattern I used throughout was this: class Foo : Bar { public auto baz(this T)(...) { ... return cast(T) this; } } Which allows chaining of methods with those of parent and child types, i.e: import tkd.tkdapplication; class Application : TkdApplication { private void exitCommand(CommandArgs args) { this.exit(); } override protected void initInterface() { auto frame = new Frame(2, ReliefStyle.groove) .pack(10); auto label = new Label(frame, "Hello World!") .pack(10); auto exitButton = new Button(frame, "Exit") .setCommand(&this.exitCommand) .pack(10); } } void main(string[] args) { auto app = new Application(); app.run(); } [1]: https://github.com/nomad-software/tkd
Apr 29 2016