www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D "Swing"

reply "Chris" <wendlec tcd.ie> writes:
There exist some GUI Toolkits for D, however, they are more or 
less all based on bindings to native toolkits.

Is anyone working on or are there plans to develop a pure 
Swing-like GUI Framework for D? While bindings have the advantage 
of using native widgets, they tend to lack behind as native 
widgets toolkits evolve and improve from version to version. 
Also, the full use of native features is not always easily 
accomplished (cf. SWT/JFace). A self-contained framework (like 
Swing) that could be extended as needed by a small set of native 
bindings - to implement os specific tasks - might be worth 
looking into.

D would have the benefit of hindsight in avoiding mistakes made 
in other GUI toolkits (such as Swing and SWT/JFace), and while 
this may sound like reinventing the wheel, catering for 
cross-platform bindings (Windows, Linux and OS X) is an endless 
race, and might not be real cross-platform after all, because 
either a whole platform is not (yet) catered for (cf. DWT), or 
some features are not yet implemented for one platform or another.

Programmers have to make practical decisions and from my own 
experience I know that nothing is worse than betting on the wrong 
horse, and at present I could not decide on a GUI toolkit for D.

Your comments and advice are more than welcome.
Dec 23 2012
next sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
On Sunday, 23 December 2012 at 21:03:40 UTC, Chris wrote:
 There exist some GUI Toolkits for D, however, they are more or 
 less all based on bindings to native toolkits.

 Is anyone working on or are there plans to develop a pure 
 Swing-like GUI Framework for D? While bindings have the 
 advantage of using native widgets, they tend to lack behind as 
 native widgets toolkits evolve and improve from version to 
 version. Also, the full use of native features is not always 
 easily accomplished (cf. SWT/JFace). A self-contained framework 
 (like Swing) that could be extended as needed by a small set of 
 native bindings - to implement os specific tasks - might be 
 worth looking into.

 D would have the benefit of hindsight in avoiding mistakes made 
 in other GUI toolkits (such as Swing and SWT/JFace), and while 
 this may sound like reinventing the wheel, catering for 
 cross-platform bindings (Windows, Linux and OS X) is an endless 
 race, and might not be real cross-platform after all, because 
 either a whole platform is not (yet) catered for (cf. DWT), or 
 some features are not yet implemented for one platform or 
 another.

 Programmers have to make practical decisions and from my own 
 experience I know that nothing is worse than betting on the 
 wrong horse, and at present I could not decide on a GUI toolkit 
 for D.

 Your comments and advice are more than welcome.

did you remember c++ lesson with qt? no, qt is good framework but in fact its better when used your custom styles(imho), native look and feel sometimes is just crappy, and custom cross platform look'n'feel for your professional oriented stuff is another plus, it instantly becomes recognizable and users don't need to adapt to version on another system. sorry if it still unclear, i'm not against bindings to native ui i'm just trying to say it is good for simple stuff only and only when ur program targeting one system(again, imho). so i think HTML/JS is the really(but not only, yes) crossplatform(phones, set top boxes, pc's, just about everywhere...), fast, cost effecient(the only tool you need to start develop is text editor and browser with developer tools, almost all if not any has such tools, there is lot of designers and JS programmers, and so on) and modern UI, so you can take a look at my recent project - http://forum.dlang.org/thread/azrwqdorulvwhjcmmrxx forum.dlang.org though it still in alpha sorry if that's not what you expect for gui framework stuff such as gtk or qt.
Dec 23 2012
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-24 12:12, Russel Winder wrote:

 Possibly worth noting that the hope is that Swing goes away very soon
 now. JavaFX is the current offering for graphics and GUI on the JVM. Of
 course writing UIs in Java is a pain, hence GroovyFX
 (http://www.groovyfx.org). But, of course, writing UIs manually is a
 pain so the generator to use is Griffon (http://griffon.codehaus.org).

Java is one of the best supported language. There exist many GUI builders for the Java platform, example: https://developers.google.com/java-dev-tools/wbpro/ -- /Jacob Carlborg
Dec 24 2012
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-24 12:56, Chris wrote:

 Yes, I agree Java is a pain when building GUI's. I only mentioned it as
 an example of an independent framework. Personally I'd prefer HTML(like)
 solutions for both desktop and mobile.

How is that working? You display a window with an HTML view and renders the complete GUI in that? Or are we just talking web applications?
 There is simply no time for
 endless platform support, especially in small teams. But JS has its
 limitations as to UI development.

I don't agree with that. In my experience a quite a lot of platform specific code is required anyway if you want to have a good application. Mobile applications have a very different GUI and look-and-feel compared to desktop applications. It's not just that the buttons are bigger and look different you might have a completely different structure of the mobile application. You just don't physically have the same amount of space on a mobile application and therefore cannot have the same content (or all the content).
 So a solution that uses HTML for
 rendering and allows any language to implement the application logic
 would get my vote. I think the D community should look in that direction
 too.

I can tell you right now that most of the developers in the D community don't share your ideas. Most people here seem to prefer a native approach. I mean, that's why we use D, otherwise we could use Java, JavaScript, Python, Ruby or something similar.
 I am simply not convinced that DWT will take off (much as I
 appreciate the work that has been put into it), because I remember the
 huge effort it took SWT/JFace developers, although they were supported
 by a large community and a big company.

The positive thing is that they already done most of the work. We just need to port it.
 Also, it seems a bit absurd that
 we have a good compilable cross-platform language like D and cannot
 fully use it as such due to GUI issues.

That I can agree with. -- /Jacob Carlborg
Dec 24 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-24 12:12, Russel Winder wrote:

 Possibly worth noting that the hope is that Swing goes away very soon
 now. JavaFX is the current offering for graphics and GUI on the JVM. Of
 course writing UIs in Java is a pain, hence GroovyFX
 (http://www.groovyfx.org). But, of course, writing UIs manually is a
 pain so the generator to use is Griffon (http://griffon.codehaus.org).

It's possible to do the same in D, although it's a bit more verbose: http://pastebin.com/twiqqLpw Also, I'm planning to write a GUI builder (somewhere down the road) for DWT. -- /Jacob Carlborg
Dec 24 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Monday, 24 December 2012 at 02:17:51 UTC, evilrat wrote:
 On Sunday, 23 December 2012 at 21:03:40 UTC, Chris wrote:
 There exist some GUI Toolkits for D, however, they are more or 
 less all based on bindings to native toolkits.

 Is anyone working on or are there plans to develop a pure 
 Swing-like GUI Framework for D? While bindings have the 
 advantage of using native widgets, they tend to lack behind as 
 native widgets toolkits evolve and improve from version to 
 version. Also, the full use of native features is not always 
 easily accomplished (cf. SWT/JFace). A self-contained 
 framework (like Swing) that could be extended as needed by a 
 small set of native bindings - to implement os specific tasks 
 - might be worth looking into.

 D would have the benefit of hindsight in avoiding mistakes 
 made in other GUI toolkits (such as Swing and SWT/JFace), and 
 while this may sound like reinventing the wheel, catering for 
 cross-platform bindings (Windows, Linux and OS X) is an 
 endless race, and might not be real cross-platform after all, 
 because either a whole platform is not (yet) catered for (cf. 
 DWT), or some features are not yet implemented for one 
 platform or another.

 Programmers have to make practical decisions and from my own 
 experience I know that nothing is worse than betting on the 
 wrong horse, and at present I could not decide on a GUI 
 toolkit for D.

 Your comments and advice are more than welcome.

did you remember c++ lesson with qt? no, qt is good framework but in fact its better when used your custom styles(imho), native look and feel sometimes is just crappy, and custom cross platform look'n'feel for your professional oriented stuff is another plus, it instantly becomes recognizable and users don't need to adapt to version on another system. sorry if it still unclear, i'm not against bindings to native ui i'm just trying to say it is good for simple stuff only and only when ur program targeting one system(again, imho).

I agree. If it gets a bit more sophisticated, it can be quite annoying when using bindings.
 so i think HTML/JS is the really(but not only, yes) 
 crossplatform(phones, set top boxes, pc's, just about 
 everywhere...), fast, cost effecient(the only tool you need to 
 start develop is text editor and browser with developer tools, 
 almost all if not any has such tools, there is lot of designers 
 and JS programmers, and so on) and modern UI, so you can take a 
 look at my recent project - 
 http://forum.dlang.org/thread/azrwqdorulvwhjcmmrxx forum.dlang.org 
 though it still in alpha


 sorry if that's not what you expect for gui framework stuff 
 such as gtk or qt.

I'd prefer a fully-fledged pure D solution for desktop apps. With D's ability to integrate C code native extensions should be manageable. But the framework should be self-contained like Swing. With extensions I mean things like using a Mac menu bar, use system services etc but the widgets should be D's own. However, I also like HTML/JS solutions but am not sure whether they can replace a real GUI framework like Cocoa or Swing. JS is at times cumbersome to use for user interfaces.
Dec 24 2012
prev sibling next sibling parent "evilrat" <evilrat666 gmail.com> writes:
On Monday, 24 December 2012 at 10:34:42 UTC, Chris wrote:
 so i think HTML/JS is the really(but not only, yes) 
 crossplatform(phones, set top boxes, pc's, just about 
 everywhere...), fast, cost effecient(the only tool you need to 
 start develop is text editor and browser with developer tools, 
 almost all if not any has such tools, there is lot of 
 designers and JS programmers, and so on) and modern UI, so you 
 can take a look at my recent project - 
 http://forum.dlang.org/thread/azrwqdorulvwhjcmmrxx forum.dlang.org 
 though it still in alpha


 sorry if that's not what you expect for gui framework stuff 
 such as gtk or qt.

I'd prefer a fully-fledged pure D solution for desktop apps. With D's ability to integrate C code native extensions should be manageable. But the framework should be self-contained like Swing. With extensions I mean things like using a Mac menu bar, use system services etc but the widgets should be D's own. However, I also like HTML/JS solutions but am not sure whether they can replace a real GUI framework like Cocoa or Swing. JS is at times cumbersome to use for user interfaces.

i'd try to clarify... my project IS just another bindings project but it binds to HTML stuff library. inside this library one could do anything using only declarative language(HTML+CSS) and bind that declarative code using JS to D part, that way one would focusing on making UI elements, UI style(look'n'feel), UI JS glueing code(and thats all separatedly, MVC in effect) apart from native D code, so writing cocoa menu's or other stuff and present it to HTML world should be simple, actually it even doesn't need to do this, since D part would contain business logic and HTML part is just all UI code isolated. so it's more likely one may want just make programmaticaly-like UI framework(like qt/gtk) on top of HTML/CSS/JS written in D which does all declarative and glueing stuff behind the scene to mimic "truly D ui's", at least from programmers point of view there would be no difference.
Dec 24 2012
prev sibling next sibling parent Russel Winder <russel winder.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2012-12-24 at 11:34 +0100, Chris wrote:
[=E2=80=A6]
 However, I also like HTML/JS solutions but am not sure whether=20
 they can replace a real GUI framework like Cocoa or Swing. JS is=20
 at times cumbersome to use for user interfaces.

Possibly worth noting that the hope is that Swing goes away very soon now. JavaFX is the current offering for graphics and GUI on the JVM. Of course writing UIs in Java is a pain, hence GroovyFX (http://www.groovyfx.org). But, of course, writing UIs manually is a pain so the generator to use is Griffon (http://griffon.codehaus.org). --=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=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 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Dec 24 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Monday, 24 December 2012 at 11:12:15 UTC, Russel Winder wrote:
 On Mon, 2012-12-24 at 11:34 +0100, Chris wrote:
 […]
 However, I also like HTML/JS solutions but am not sure whether 
 they can replace a real GUI framework like Cocoa or Swing. JS 
 is at times cumbersome to use for user interfaces.

Possibly worth noting that the hope is that Swing goes away very soon now. JavaFX is the current offering for graphics and GUI on the JVM. Of course writing UIs in Java is a pain, hence GroovyFX (http://www.groovyfx.org). But, of course, writing UIs manually is a pain so the generator to use is Griffon (http://griffon.codehaus.org).

Yes, I agree Java is a pain when building GUI's. I only mentioned it as an example of an independent framework. Personally I'd prefer HTML(like) solutions for both desktop and mobile. There is simply no time for endless platform support, especially in small teams. But JS has its limitations as to UI development. So a solution that uses HTML for rendering and allows any language to implement the application logic would get my vote. I think the D community should look in that direction too. I am simply not convinced that DWT will take off (much as I appreciate the work that has been put into it), because I remember the huge effort it took SWT/JFace developers, although they were supported by a large community and a big company. Also, it seems a bit absurd that we have a good compilable cross-platform language like D and cannot fully use it as such due to GUI issues.
Dec 24 2012
prev sibling next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-23 22:03, Chris wrote:
 There exist some GUI Toolkits for D, however, they are more or less all
 based on bindings to native toolkits.

 Is anyone working on or are there plans to develop a pure Swing-like GUI
 Framework for D? While bindings have the advantage of using native
 widgets, they tend to lack behind as native widgets toolkits evolve and
 improve from version to version. Also, the full use of native features
 is not always easily accomplished (cf. SWT/JFace). A self-contained
 framework (like Swing) that could be extended as needed by a small set
 of native bindings - to implement os specific tasks - might be worth
 looking into.

Am one of those who prefer to use native widgets compared to something like GTK. But as you say they don't all provide all features. I think a good idea is the use a cross-platform GUI library for the common widgets that exists on all platforms, i.e. buttons and windows. There's not reason to use the native API for those. Then extend that with platform specif code using the native API, i.e. unified tool bar, sheets and so on, that is found on Mac OS X.
 D would have the benefit of hindsight in avoiding mistakes made in other
 GUI toolkits (such as Swing and SWT/JFace), and while this may sound
 like reinventing the wheel, catering for cross-platform bindings
 (Windows, Linux and OS X) is an endless race, and might not be real
 cross-platform after all, because either a whole platform is not (yet)
 catered for (cf. DWT), or some features are not yet implemented for one
 platform or another.

I agree that it would be really nice to have a cross-platform GUI framework written explicitly for D. But as you say that would be an enormous task to do. I'm working on the Mac OS X port of DWT. It all compiles but a lot is not working. Some snippets are working: https://github.com/d-widget-toolkit/dwt-mac Any help is appreciated.
 Programmers have to make practical decisions and from my own experience
 I know that nothing is worse than betting on the wrong horse, and at
 present I could not decide on a GUI toolkit for D.

 Your comments and advice are more than welcome.

-- /Jacob Carlborg
Dec 24 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-24 13:59, Chris wrote:

 But there will always be the issue of "feature not yet supported

I don't see how your approach would be any difference. "Hey, the Win32 API has support for a calender widget, why doesn't the standard D GUI support that".
 and bugs are introduced when the same code is run on a higher version of a
 given os. And it may take a while to fix it, i.e. to know what has
 changed in the new version etc. Native bindings are a never ending
 story.

The same thing can happen with a non-native GUI as well. You need to use some kind of functionality to draw the GUI somewhere.
 I have worked with some native-binding framworks and there is
 always an issue (maybe even a bug in the native os).

It's sounds like your suggesting that a non-native approach wouldn't have any bugs. I'm sure you're not, that would be crazy.
 I agree that it would be really nice to have a cross-platform GUI
 framework written explicitly for D. But as you say that would be an
 enormous task to do.

Not sure. Maybe trying to catch up with and cater for at least 3 different platforms is the bigger task in the long run.

I can assure you that what the SWT/JFace developers are doing and have been doing for many many years are far more time consuming than porting SWT to D. We would have to the same work as we're doing now, plus the same work as the SWT developers have been doing for, say, that last 20 years. Note also that DWT doesn't support nearly as many platforms as SWT does, and probably never will. Hmm it seems they have dropped the support for a couple of platforms.
 In my opinion, as D is getting ever more mature, it is about time we had
 a reliable standard cross-platform GUI. It need not be a framework like
 Swing. Maybe a more modern solution (HTML etc) would do the trick.

I don't think that would work with the D community.
 I think there is a widening gap between what you can do with D in terms of
 business logic (a lot) and what you can do with it in terms of
 connecting it to the desktop / smartphone, i.e. to the user. D has what
 it takes but languages can only take off if they have some sort of GUI
 too (cf. Objective-C after the iPhone was introduced, and app
 development in general). Sorry, that's my marketing mind speaking again.

I more than agree that D needs a GUI library, I just don't agree with you how it should be done. -- /Jacob Carlborg
Dec 24 2012
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-24 14:39, evilrat wrote:

 why not? have you read my post in this thread? having a Qt-like or
 Gtk-like interface framework which would give users "widgets" by hiding
 declarative and glueing code would be practically same way as using
 other non-D toolkits including their D ports.

It's just a feeling I have but I can be wrong.
 and this is another problem, while D has lots of users, the current
 active community is quite small(correct me if i'm wrong), and even in
 such case all programmers trying to do their own stuff because they
 think their way is more "correct", yes you can judge me too, but sadly
 this is the fact.

Yeah, I know. -- /Jacob Carlborg
Dec 24 2012
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-24 14:51, Chris wrote:

 No, of course not. But the bugs would be in-house, i.e. in one place and
 could be dealt with immedieately, whereas with native bindings you have
 two possible sources for bugs, one of which (the native os) you have no
 control over whatsoever.

You always need to have some kind of connection to some other library/platform, be it a web browser or the native GUI of the system. You might be able to minimize that connection and minimize the number of bugs there is always the possibility of bugs.
 I don't actually care how exactly a standard GUI toolkit for D is
 accomplished (I am not into software-philosophical debates) as long as
 it is done and done quickly (My apologies, I sound like a CEO now!). I
 only have my doubts whether DWT is really the best solution or whether
 we are just wasting time.

DWT is done (well, nothing is ever done but useable) now, except from for Mac OS X. Can you point me to some other GUI library that is done and is using a non-native approach? Well, now that I'm thinking about it there's GTK, which is basically the only other GUI option for D that is usable. GTK is far from native. -- /Jacob Carlborg
Dec 24 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-25 22:40, Chris wrote:
 Is there a timeline for DWT Mac (moving it to D2)?

Unfortunately no, there is no timeline. I'm doing this on my spare time which, as for most here, is very limited. I'm also working on other D projects.
 I think it's D1 & Tango at the moment.

Yes, that's correct. I started the Mac port when DWT was still only D1 Tango. I've been working on this way too long.
 Will there be D2 & Phobos?

It definitely will be. Since I started with D1 and Tango I want to finish the port first, before I switch to D2. I'm hoping the switch to D2 will be fairly easy since the utility libraries/functions are already ported to D2 (the Windows and Linux versions use them).
 Sorry if the questions are a bit naive. I'd love to use DWT. For now, I can
use a Cocoa front
 end for my D program, but I'd love to have a cross-platform GUI one day.

I want to use DWT as well. Since my main platform is Mac OS X it will happen.
 By the way, how do you pronounce DWT - "DWAT"?

I pronounce the three characters separately, D-W-T. DWT is short for D Widget Toolkit. A play on the original name SWT - Standard Widget Toolkit.
 I was also thinking that embedded D (like PHP or JSP) would be nice too.
 I know, I am a bit of a D-reamer, but I think D should get out there
 into the world of "real world" applications. It's just too good to
 remain an "insider thing".

D kind of had that feature. I don't know if it's still available but deprecated or completely removed. I think it could extract all code in code-tags: <code>int i = 0;</code> http://digitalmars.com/d/1.0/html.html -- /Jacob Carlborg
Dec 26 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-26 17:32, Chris wrote:

 Time is an issue, I know. I'd like to help you but my time is limited too.

What could be helpful is testing the snippets and see which works and which don't. I've started to adapt the snippets from the current DWT snippet repository to the DWT Mac repository. Snippets: https://github.com/d-widget-toolkit/org.eclipse.swt.snippets The "todo.taskpaper" file contains a list the snippets and their status. DWT Mac repository: https://github.com/d-widget-toolkit/dwt-mac
 Now that you mention it, I read that too. I was thinking of a PHP like
 embedding like this:

 <html>
 ...
 <?d
 auto greeting = "Hello";
 writeln(greeting);
 ?>
 ...
 </html>

 I wonder how hard it would be to implement something like this for D.

Not that hard I think. Oh, now that I think of it, you should check out Vibe.d and especially its templates: http://vibed.org/features#diet-templates -- /Jacob Carlborg
Dec 26 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-28 13:05, Chris wrote:

 I see. If you have a list or better a *description* of what has to be
 done to finish the project and to update it to D2 (possibly with Phobos
 integration) please send it to me. My email address is there I think.
 Maybe I can have a look at it. I have some vague experience with
 combining Ojective-C and D, also I know the Cocoa Framework (although
 not the latest flashy additions that come with each new version of OS X,
 I been outta touch for a while now).

The current status is that everything compiles, but far from everything runs. I'm trying to collect a list of snippets that doesn't work and then try to fix them. I think the best approach is to try and fix as many snippets as possible before moving to D2. Here's the list of the status of the snippets I've tested: https://github.com/d-widget-toolkit/dwt-mac/blob/master/todo.taskpaper#L12 The run tag indicates the snippet doesn't crash but it seems somethings aren't working properly. The snippets I'm using are these: https://github.com/d-widget-toolkit/org.eclipse.swt.snippets They are actually for the D2 port but they're easy to adapt to D1. It's mostly just changing the import statements. I'm using DMD 1.072. I know for sure that version works with Tango. I'm only compiling 32bit for now. You can install DMD 1.072 and Tango using DVM: https://github.com/jacob-carlborg/dvm I've written a porting guide here: https://github.com/d-widget-toolkit/dwt-mac -- /Jacob Carlborg
Dec 28 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-28 19:13, Chris wrote:

 Thanks a million. I will have a look. I am adamant to get on with DWT
 for Mac. What about moving to D2 right now instead of debugging for D1 &
 Tango first? Are there any reasons why debugging for D1 & Tango should
 be prioritized? Maybe it'd be better to get rid of old debts and start a
 new fork or branch with D2 Tango / Phobos.

I think that would be a bad idea. When something doesn't work it will be hard to figure out if it was a mistake porting Java to D or porting D1 to D2. -- /Jacob Carlborg
Dec 28 2012
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-28 19:50, Chris wrote:

 And starting from scratch with D2?

That would be the worst idea.
 How much would that take?

I would be stupid to start from the beginning. That would take most effort and the most time of all options. -- /Jacob Carlborg
Dec 28 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-29 13:10, Chris wrote:

 Perhaps yes, I'm not yet familiar enough with the internal mechanisms of
 porting and I don't know D1 because I started with D2 (Phobos).

D1 is just missing some features and we're using Tango here instead of Phobos. But since this is a port of a Java library, you basically just think Java, if you know it. -- /Jacob Carlborg
Dec 29 2012
parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-29 13:55, Chris wrote:

 I have read your description of the ObjC bridge and have done
 something similar too. I was thinking that developing minimal
 binding/bridging mechanisms for various languages would be a good thing
 in order to glue D to anything you want. Again, time is a crucial factor.

The problem with this bridge is bloat. A Hello World GUI application takes around 60MB in size. It's basically a dead end. This is a better solution: http://michelf.ca/projects/d-objc/ It adds support for extern (Objective-C), i.e. ABI compatibility with Objective-C. Michel Fortin hasn't worked on this for a couple of years but I have started to continue on his work. -- /Jacob Carlborg
Dec 29 2012
parent Jacob Carlborg <doob me.com> writes:
On 2012-12-29 16:38, Chris wrote:

 I've heard of this project but always had one problem or another with
 it. I agree that it is the better solution but I could never make it
 work properly (probably my own fault).

If you download the pre-compiled alpha it should just work out of the box just as a regular DMD release does.
 I agree that bridges are never a good solution (cf. the Cocoa-Java
 Bridge). I was thinking of a mechanism that isn't bloated, i.e. that
 only takes what it needs, if that's at all possible. I've succeeded in
 using ObjC from D (via D's C compatiblity) and it wasn't bloated.

I created basically complete bindings for the Foundation and AppKit frameworks and some others as well. That will cause bloat. I think it's either virtual methods that cannot be optimized away or templates that causing the bloat. The problem with the approached used by DWT/SWT is they only create bindings for what's needed. I guess that's also why it's not as bloated. Then one needs to create binding for each new method one wants to use. That's quite a cumbersome workflow.
 My idea is to call D from within a Cocoa application, so that Cocoa is only
 the interface layer. In the same way D could take care of the business
 logic on other platforms too and use a C based GUI having a thin
 "translation" layer between the two. It's not as smooth as having native
 bindings and a unified API like DWT, wxD etc. but it gives me freedom of
 choice and flexibility.

Yeah, that would be possible as well.
 Btw, how does D fare with mobile phones? Are there issues with 32 and 64
 bit? The JavaScript backend (see post above) might come in handy here.

Mobile devices are usually use the ARM architecture, which isn't supported by DMD. You would either need to use GDC or LDC. I think the biggest problem here is that the runtime isn't properly adapted to ARM. -- /Jacob Carlborg
Dec 29 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-29 00:10, Chris wrote:
 Here is an article about difficulties in cross-platform GUI development
 (nothing new, really).

 http://www.informit.com/articles/article.aspx?p=787261

 QtD doesn't need GCD anymore, apparently. I remember there were several
 fussy requirements for QtD a year or so ago that were rather off-putting.

 http://www.dsource.org/projects/qtd

Don't if QtD works. It's not native and it hasn't been update for two years. Last thing I heard they struggled with the C++ bindings. -- /Jacob Carlborg
Dec 29 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Monday, 24 December 2012 at 11:59:31 UTC, Jacob Carlborg wrote:

 Am one of those who prefer to use native widgets compared to 
 something like GTK. But as you say they don't all provide all 
 features. I think a good idea is the use a cross-platform GUI 
 library for the common widgets that exists on all platforms, 
 i.e. buttons and windows. There's not reason to use the native 
 API for those. Then extend that with platform specif code using 
 the native API, i.e. unified tool bar, sheets and so on, that 
 is found on Mac OS X.


 I agree that it would be really nice to have a cross-platform 
 GUI framework written explicitly for D. But as you say that 
 would be an enormous task to do.

 I'm working on the Mac OS X port of DWT. It all compiles but a 
 lot is not working. Some snippets are working:

 https://github.com/d-widget-toolkit/dwt-mac

 Any help is appreciated.

Perhaps the link you just posted could provide a HTML-based solution: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org That'd be pretty cool.
Dec 24 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
 Am one of those who prefer to use native widgets compared to 
 something like GTK. But as you say they don't all provide all 
 features. I think a good idea is the use a cross-platform GUI 
 library for the common widgets that exists on all platforms, 
 i.e. buttons and windows. There's not reason to use the native 
 API for those. Then extend that with platform specif code using 
 the native API, i.e. unified tool bar, sheets and so on, that 
 is found on Mac OS X.

But there will always be the issue of "feature not yet supported" and bugs are introduced when the same code is run on a higher version of a given os. And it may take a while to fix it, i.e. to know what has changed in the new version etc. Native bindings are a never ending story. I have worked with some native-binding framworks and there is always an issue (maybe even a bug in the native os).
 I agree that it would be really nice to have a cross-platform 
 GUI framework written explicitly for D. But as you say that 
 would be an enormous task to do.

Not sure. Maybe trying to catch up with and cater for at least 3 different platforms is the bigger task in the long run. In my opinion, as D is getting ever more mature, it is about time we had a reliable standard cross-platform GUI. It need not be a framework like Swing. Maybe a more modern solution (HTML etc) would do the trick. I think there is a widening gap between what you can do with D in terms of business logic (a lot) and what you can do with it in terms of connecting it to the desktop / smartphone, i.e. to the user. D has what it takes but languages can only take off if they have some sort of GUI too (cf. Objective-C after the iPhone was introduced, and app development in general). Sorry, that's my marketing mind speaking again.
Dec 24 2012
prev sibling next sibling parent "evilrat" <evilrat666 gmail.com> writes:
On Monday, 24 December 2012 at 13:21:57 UTC, Jacob Carlborg wrote:
 On 2012-12-24 13:59, Chris wrote:

 In my opinion, as D is getting ever more mature, it is about 
 time we had
 a reliable standard cross-platform GUI. It need not be a 
 framework like
 Swing. Maybe a more modern solution (HTML etc) would do the 
 trick.

I don't think that would work with the D community.

why not? have you read my post in this thread? having a Qt-like or Gtk-like interface framework which would give users "widgets" by hiding declarative and glueing code would be practically same way as using other non-D toolkits including their D ports.
 I more than agree that D needs a GUI library, I just don't 
 agree with you how it should be done.

and this is another problem, while D has lots of users, the current active community is quite small(correct me if i'm wrong), and even in such case all programmers trying to do their own stuff because they think their way is more "correct", yes you can judge me too, but sadly this is the fact.
Dec 24 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
[..]
 I have worked with some native-binding framworks and there is
 always an issue (maybe even a bug in the native os).


 It's sounds like your suggesting that a non-native approach 
 wouldn't have any bugs. I'm sure you're not, that would be 
 crazy.

No, of course not. But the bugs would be in-house, i.e. in one place and could be dealt with immedieately, whereas with native bindings you have two possible sources for bugs, one of which (the native os) you have no control over whatsoever. I don't actually care how exactly a standard GUI toolkit for D is accomplished (I am not into software-philosophical debates) as long as it is done and done quickly (My apologies, I sound like a CEO now!). I only have my doubts whether DWT is really the best solution or whether we are just wasting time. This said, my post is not intended to slight the efforts of DWT developers, far be it from me!
Dec 24 2012
prev sibling next sibling parent "Zz" <zz nospam.com> writes:
Have a look at Sciter (http://www.terrainformatica.com/sciter), 
Andrew Fedoniouk of Terra Informatica once did Harmonia for D1, 
Hope he would do a Sciter version or wrapper for D2.

Zz

On Monday, 24 December 2012 at 10:57:48 UTC, evilrat wrote:
 On Monday, 24 December 2012 at 10:34:42 UTC, Chris wrote:
 so i think HTML/JS is the really(but not only, yes) 
 crossplatform(phones, set top boxes, pc's, just about 
 everywhere...), fast, cost effecient(the only tool you need 
 to start develop is text editor and browser with developer 
 tools, almost all if not any has such tools, there is lot of 
 designers and JS programmers, and so on) and modern UI, so 
 you can take a look at my recent project - 
 http://forum.dlang.org/thread/azrwqdorulvwhjcmmrxx forum.dlang.org 
 though it still in alpha


 sorry if that's not what you expect for gui framework stuff 
 such as gtk or qt.

I'd prefer a fully-fledged pure D solution for desktop apps. With D's ability to integrate C code native extensions should be manageable. But the framework should be self-contained like Swing. With extensions I mean things like using a Mac menu bar, use system services etc but the widgets should be D's own. However, I also like HTML/JS solutions but am not sure whether they can replace a real GUI framework like Cocoa or Swing. JS is at times cumbersome to use for user interfaces.

i'd try to clarify... my project IS just another bindings project but it binds to HTML stuff library. inside this library one could do anything using only declarative language(HTML+CSS) and bind that declarative code using JS to D part, that way one would focusing on making UI elements, UI style(look'n'feel), UI JS glueing code(and thats all separatedly, MVC in effect) apart from native D code, so writing cocoa menu's or other stuff and present it to HTML world should be simple, actually it even doesn't need to do this, since D part would contain business logic and HTML part is just all UI code isolated. so it's more likely one may want just make programmaticaly-like UI framework(like qt/gtk) on top of HTML/CSS/JS written in D which does all declarative and glueing stuff behind the scene to mimic "truly D ui's", at least from programmers point of view there would be no difference.

Dec 24 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
Is there a timeline for DWT Mac (moving it to D2)? I think it's 
D1 & Tango at the moment. Will there be D2 & Phobos? Sorry if the 
questions are a bit naive. I'd love to use DWT. For now, I can 
use a Cocoa front end for my D program, but I'd love to have a 
cross-platform GUI one day.

By the way, how do you pronounce DWT - "DWAT"?

I was also thinking that embedded D (like PHP or JSP) would be 
nice too. I know, I am a bit of a D-reamer, but I think D should 
get out there into the world of "real world" applications. It's 
just too good to remain an "insider thing".
Dec 25 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Wednesday, 26 December 2012 at 15:54:12 UTC, Jacob Carlborg 
wrote:
 On 2012-12-25 22:40, Chris wrote:

 Unfortunately no, there is no timeline. I'm doing this on my 
 spare time which, as for most here, is very limited. I'm also 
 working on other D projects.

Time is an issue, I know. I'd like to help you but my time is limited too.
 It definitely will be. Since I started with D1 and Tango I want 
 to finish the port first, before I switch to D2. I'm hoping the 
 switch to D2 will be fairly easy since the utility 
 libraries/functions are already ported to D2 (the Windows and 
 Linux versions use them).

That would be great.
 I want to use DWT as well. Since my main platform is Mac OS X 
 it will happen.

 I pronounce the three characters separately, D-W-T. DWT is 
 short for D Widget Toolkit. A play on the original name SWT - 
 Standard Widget Toolkit.

I once read that SWT is pronounced "SWAT", so I thought "DWAT" would be the logical consequence (which sounds a bit like "twat").
 D kind of had that feature. I don't know if it's still 
 available but deprecated or completely removed. I think it 
 could extract all code in code-tags:

 <code>int i = 0;</code>

 http://digitalmars.com/d/1.0/html.html

Now that you mention it, I read that too. I was thinking of a PHP like embedding like this: <html> ... <?d auto greeting = "Hello"; writeln(greeting); ?> ... </html> I wonder how hard it would be to implement something like this for D.
Dec 26 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Wednesday, 26 December 2012 at 18:54:15 UTC, Jacob Carlborg 
wrote:
 On 2012-12-26 17:32, Chris wrote:

 What could be helpful is testing the snippets and see which 
 works and which don't. I've started to adapt the snippets from 
 the current DWT snippet repository to the DWT Mac repository.

 Snippets: 
 https://github.com/d-widget-toolkit/org.eclipse.swt.snippets

I can try to do that next year in January.
 The "todo.taskpaper" file contains a list the snippets and 
 their status.

 DWT Mac repository: https://github.com/d-widget-toolkit/dwt-mac

 Not that hard I think.  Oh, now that I think of it, you should 
 check out Vibe.d and especially its templates:

 http://vibed.org/features#diet-templates

Now that I look at it, I have come across that page too. I haven't tested it though.
Dec 26 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
Have you seen this one:

https://github.com/sleets/dwt-mac
Dec 28 2012
prev sibling next sibling parent "Jacob Carlborg" <doob me.com> writes:
On Friday, 28 December 2012 at 11:19:11 UTC, Chris wrote:
 Have you seen this one:

 https://github.com/sleets/dwt-mac

No, but it hasn't been updated for over a year. I don't see anything indicating it has come further along in the porting process then I have. The code is originally from me. -- /Jacob Carlborg
Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Friday, 28 December 2012 at 11:51:55 UTC, Jacob Carlborg wrote:
 On Friday, 28 December 2012 at 11:19:11 UTC, Chris wrote:
 Have you seen this one:

 https://github.com/sleets/dwt-mac

No, but it hasn't been updated for over a year. I don't see anything indicating it has come further along in the porting process then I have. The code is originally from me.

I see. If you have a list or better a *description* of what has to be done to finish the project and to update it to D2 (possibly with Phobos integration) please send it to me. My email address is there I think. Maybe I can have a look at it. I have some vague experience with combining Ojective-C and D, also I know the Cocoa Framework (although not the latest flashy additions that come with each new version of OS X, I been outta touch for a while now).
Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Friday, 28 December 2012 at 14:09:27 UTC, Jacob Carlborg wrote:
 On 2012-12-28 13:05, Chris wrote:

 I see. If you have a list or better a *description* of what 
 has to be
 done to finish the project and to update it to D2 (possibly 
 with Phobos
 integration) please send it to me. My email address is there I 
 think.
 Maybe I can have a look at it. I have some vague experience 
 with
 combining Ojective-C and D, also I know the Cocoa Framework 
 (although
 not the latest flashy additions that come with each new 
 version of OS X,
 I been outta touch for a while now).

The current status is that everything compiles, but far from everything runs. I'm trying to collect a list of snippets that doesn't work and then try to fix them. I think the best approach is to try and fix as many snippets as possible before moving to D2. Here's the list of the status of the snippets I've tested: https://github.com/d-widget-toolkit/dwt-mac/blob/master/todo.taskpaper#L12 The run tag indicates the snippet doesn't crash but it seems somethings aren't working properly. The snippets I'm using are these: https://github.com/d-widget-toolkit/org.eclipse.swt.snippets They are actually for the D2 port but they're easy to adapt to D1. It's mostly just changing the import statements. I'm using DMD 1.072. I know for sure that version works with Tango. I'm only compiling 32bit for now. You can install DMD 1.072 and Tango using DVM: https://github.com/jacob-carlborg/dvm I've written a porting guide here: https://github.com/d-widget-toolkit/dwt-mac

Thanks a million. I will have a look. I am adamant to get on with DWT for Mac. What about moving to D2 right now instead of debugging for D1 & Tango first? Are there any reasons why debugging for D1 & Tango should be prioritized? Maybe it'd be better to get rid of old debts and start a new fork or branch with D2 Tango / Phobos.
Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Friday, 28 December 2012 at 18:36:17 UTC, Jacob Carlborg wrote:
 On 2012-12-28 19:13, Chris wrote:

 Thanks a million. I will have a look. I am adamant to get on 
 with DWT
 for Mac. What about moving to D2 right now instead of 
 debugging for D1 &
 Tango first? Are there any reasons why debugging for D1 & 
 Tango should
 be prioritized? Maybe it'd be better to get rid of old debts 
 and start a
 new fork or branch with D2 Tango / Phobos.

I think that would be a bad idea. When something doesn't work it will be hard to figure out if it was a mistake porting Java to D or porting D1 to D2.

And starting from scratch with D2? How much would that take? Given that you already have the know-how. Anyway, I will have a look at the links you've posted. Alas that Mac users seem to be a minority among D users! I see so many people using Mac these days. Maybe Apple will include D one day.
Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
Here is an article about difficulties in cross-platform GUI 
development (nothing new, really).

http://www.informit.com/articles/article.aspx?p=787261

QtD doesn't need GCD anymore, apparently. I remember there were 
several fussy requirements for QtD a year or so ago that were 
rather off-putting.

http://www.dsource.org/projects/qtd

Another GUI toolkit I have come across is this one:

http://www.tecgraf.puc-rio.br/iup/

It sounds very interesting and is based on ANSI C and / or Lua. 
If D bindings aren't too hard to implement it might be of 
interest to the D community.

It runs on OS X too using X11, but maybe the GTKD add on for Mac 
has solved this issue already:

http://www.tecgraf.puc-rio.br/iup/en/toolkits.html
Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Friday, 28 December 2012 at 23:10:54 UTC, Chris wrote:
 Here is an article about difficulties in cross-platform GUI

 Another GUI toolkit I have come across is this one:

 http://www.tecgraf.puc-rio.br/iup/

Dec 28 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Friday, 28 December 2012 at 23:29:46 UTC, Jacob Carlborg wrote:
 On 2012-12-28 19:50, Chris wrote:

 And starting from scratch with D2?

That would be the worst idea.
 How much would that take?

I would be stupid to start from the beginning. That would take most effort and the most time of all options.

Perhaps yes, I'm not yet familiar enough with the internal mechanisms of porting and I don't know D1 because I started with D2 (Phobos).
Dec 29 2012
prev sibling next sibling parent "Chris" <wendlec tcd.ie> writes:
On Saturday, 29 December 2012 at 12:35:22 UTC, Jacob Carlborg 
wrote:
 On 2012-12-29 13:10, Chris wrote:

 D1 is just missing some features and we're using Tango here 
 instead of Phobos. But since this is a port of a Java library, 
 you basically just think Java, if you know it.

Yes, I know Java and I wrote a no-nonsense application using SWT/JFace a couple of years ago, so I'm basically familiar with both of them. I know Cocoa & Objective-C too. That's why I'd like to help you out with the DWT Mac project, time permitting. I was also thinking about an interim solution that uses Cocoa as UI layer and have the business logic entiely in D2 using a bridge or something. I have read your description of the ObjC bridge and have done something similar too. I was thinking that developing minimal binding/bridging mechanisms for various languages would be a good thing in order to glue D to anything you want. Again, time is a crucial factor.
Dec 29 2012
prev sibling parent "Chris" <wendlec tcd.ie> writes:
On Saturday, 29 December 2012 at 15:07:06 UTC, Jacob Carlborg 
wrote:
 On 2012-12-29 13:55, Chris wrote:

 application takes around 60MB in size. It's basically a dead 
 end.

 This is a better solution:

 http://michelf.ca/projects/d-objc/

 It adds support for extern (Objective-C), i.e. ABI 
 compatibility with Objective-C. Michel Fortin hasn't worked on 
 this for a couple of years but I have started to continue on 
 his work.

I've heard of this project but always had one problem or another with it. I agree that it is the better solution but I could never make it work properly (probably my own fault). I agree that bridges are never a good solution (cf. the Cocoa-Java Bridge). I was thinking of a mechanism that isn't bloated, i.e. that only takes what it needs, if that's at all possible. I've succeeded in using ObjC from D (via D's C compatiblity) and it wasn't bloated. My idea is to call D from within a Cocoa application, so that Cocoa is only the interface layer. In the same way D could take care of the business logic on other platforms too and use a C based GUI having a thin "translation" layer between the two. It's not as smooth as having native bindings and a unified API like DWT, wxD etc. but it gives me freedom of choice and flexibility. Btw, how does D fare with mobile phones? Are there issues with 32 and 64 bit? The JavaScript backend (see post above) might come in handy here.
Dec 29 2012