www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to proceed with learning to code Windows desktop applications?

reply I =?UTF-8?B?TGluZHN0csO2bQ==?= <nota.real address.com> writes:
Hello all!

I've been doing console apps for about a year and a half now, but 
my requirements are reaching the limits of easy to use with 
ASCII-based UI and typed commands so I'm thinking of moving into 
GUI-era with my projects. I was wondering if some one could help 
me into the right direction. I've been Googling a ton these past 
few days for some kind of a book or a course on how to code 
desktop applications for Windows, but either there isn't one, or 
it's very well hidden. I've found bits and pieces but nothing to 
give me a coherent approach.

The other way I've been thinking is to do the thing 
browser-based, but for some reason that doesn't feel right.
Jan 29
next sibling parent reply welkam <wwwelkam gmail.com> writes:
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 The other way I've been thinking is to do the thing 
 browser-based, but for some reason that doesn't feel right.
Well it didnt felt wrong for Microsoft to use modified internet explorer to make calculator. You can read more on universal windows apps and XAML To learn GUI development first find GUI framework like GTK, QT etc. then watch and/or read tutorials on how to use them. For D language a list of libraries could be found here https://wiki.dlang.org/GUI_Libraries
Jan 29
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 29/01/2018 11:56 PM, welkam wrote:
 On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 The other way I've been thinking is to do the thing browser-based, but 
 for some reason that doesn't feel right.
Well it didnt felt wrong for Microsoft to use modified internet explorer to make calculator. You can read more on universal windows apps and XAML To learn GUI development first find GUI framework like GTK, QT etc. then watch and/or read tutorials on how to use them. For D language a list of libraries could be found here https://wiki.dlang.org/GUI_Libraries
But since Windows is the only platform mentioned or desired for, everything you need is in WinAPI!
Jan 29
parent reply thedeemon <dlang thedeemon.com> writes:
On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole 
wrote:

 But since Windows is the only platform mentioned or desired 
 for, everything you need is in WinAPI!
It's like saying "everything you need is assembly language" when talking about languages and compilers. Pure WinAPI is a cruel advice for a novice.
Jan 29
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 30/01/2018 5:47 AM, thedeemon wrote:
 On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole wrote:
 
 But since Windows is the only platform mentioned or desired for, 
 everything you need is in WinAPI!
It's like saying "everything you need is assembly language" when talking about languages and compilers. Pure WinAPI is a cruel advice for a novice.
There are libraries such as[0], so it isn't cruel, but it is something worth while at least to look into for someone who might be interested in it, but doesn't know where to begin. [0] https://bitbucket.org/dgui/dgui
Jan 29
parent Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Tuesday, 30 January 2018 at 06:25:52 UTC, rikki cattermole 
wrote:
 On 30/01/2018 5:47 AM, thedeemon wrote:
 On Tuesday, 30 January 2018 at 03:07:38 UTC, rikki cattermole 
 wrote:
 
 But since Windows is the only platform mentioned or desired 
 for, everything you need is in WinAPI!
It's like saying "everything you need is assembly language" when talking about languages and compilers. Pure WinAPI is a cruel advice for a novice.
There are libraries such as[0], so it isn't cruel, but it is something worth while at least to look into for someone who might be interested in it, but doesn't know where to begin. [0] https://bitbucket.org/dgui/dgui
There's also DWT which has the advantage of being portable.
Jan 29
prev sibling parent Kagamin <spam here.lot> writes:
On Tuesday, 30 January 2018 at 05:47:11 UTC, thedeemon wrote:
 It's like saying "everything you need is assembly language" 
 when talking about languages and compilers. Pure WinAPI is a 
 cruel advice for a novice.
He's not a novice: he wrote console applications that pushed through complexity limit. Writing complex GUI application in winapi is cruel, but for hello world it's fine and gives good understanding of principles. To use GUI frameworks one must understand both underlying principles and abstractions rolled on top of them.
Jan 30
prev sibling next sibling parent reply DanielG <simpletangent gmail.com> writes:
There are far too many options for Windows GUI programming, so we 
probably need a bit more information about any constraints that 
are important to you.

For example:

- do you specifically want something that works well with D? or 
are you open to other languages?

- are you just wanting to learn desktop programming in general? 
(Like the concepts involved) Or do you have a specific thing you 
want to create?

I would personally suggest Delphi to somebody who wants to write 
Windows desktop apps and learn about event-driven development, 
howeverrr the language (Object Pascal) is insufferably archaic 
compared to something like D. But it is definitely the cleanest, 
least-overwhelming method of writing native Win32 applications 
for somebody with no prior experience.

Then there's all the modern Microsoft stuff (WPF/XAML/WinRT/etc), 
but you pretty much have to use either .NET or C++ for that.
Jan 29
next sibling parent reply rjframe <dlang ryanjframe.com> writes:
On Tue, 30 Jan 2018 05:56:51 +0000, DanielG wrote:

 Then there's all the modern Microsoft stuff (WPF/XAML/WinRT/etc),
 but you pretty much have to use either .NET or C++ for that.
VS release builds compile to native now by default; for easy Windows programming, you really can't beat C# and drawing the GUI (Windows Forms, not necessarily the new stuff). If the OP wants to learn what's needed for more complex GUI tasks (like for most non-simple applications), learning to build a GUI from source is kind of necessary though. If/when .NET Core becomes something people can rely on and are willing to try, I think we'll see more people using C# outside the enterprise; you get easy when you want it, power when you need it, native code generation on Windows, and OS portability.
Jan 30
parent reply I =?UTF-8?B?TGluZHN0csO2bQ==?= <nota.real address.com> writes:
On Tuesday, 30 January 2018 at 12:30:36 UTC, rjframe wrote:
 VS release builds compile to native now by default; for easy 
 Windows programming, you really can't beat C# and drawing the 
 GUI (Windows Forms, not necessarily the new stuff). If the OP 
 wants to learn what's needed for more complex GUI tasks (like 
 for most non-simple applications), learning to build a GUI from 
 source is kind of necessary though.
I've been looking into C# and VS2017 today along with VisualD. Reading through all this it looks like the simplest path is to learn C# and VS and go from there. I've found a pile of courses on LinkedIn that seem to build up to what I need. What makes me sad is that I have to drop D for at least the time being.
Jan 30
next sibling parent thedeemon <dlang thedeemon.com> writes:
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote:
 I've been looking into C# and VS2017 today along with VisualD. 
 Reading through all this it looks like the simplest path is to 
 learn C# and VS and go from there. I've found a pile of courses 
 on LinkedIn that seem to build up to what I need. What makes me 
 sad is that I have to drop D for at least the time being.
The good news is after you learn the basics of WinForms in C#, you can take DFL and have basically all the same code in D. DFL (D Forms Library) is a pure D thin wrapper around WinAPI that looks like an identical twin of WinForms. There was even some visual forms builder for it. And then, once you're familiar with this kind of GUI lib, it's not hard to learn DlangUI or GtkD or some other libraries mentioned above. D does have GUI libs, just not books and courses about them.
Jan 31
prev sibling parent reply Arredondo <arm.plus gmail.com> writes:
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote:
 On Tuesday, 30 January 2018 at 12:30:36 UTC, rjframe wrote:
 VS release builds compile to native now by default; for easy 
 Windows programming, you really can't beat C# and drawing the 
 GUI (Windows Forms, not necessarily the new stuff). If the OP 
 wants to learn what's needed for more complex GUI tasks (like 
 for most non-simple applications), learning to build a GUI 
 from source is kind of necessary though.
I've been looking into C# and VS2017 today along with VisualD. Reading through all this it looks like the simplest path is to learn C# and VS and go from there. I've found a pile of courses on LinkedIn that seem to build up to what I need. What makes me sad is that I have to drop D for at least the time being.
As other have said, WPF and C# is the way to go for Windows GUI programming, but you don't necessarily need to drop D. You could write your interface code in VS and have it call your D library via pinvoke (Platform Invoke). To make this work you must mark your public D functions with extern(C). Read the documentation on extern(C) and PInvoke. Honestly, I don't know why more people don't do this. It really seems to be like the best of both worlds, as C# + WPF is king for Windows GUI and D is king for library development. The only drawback I can think of is you have to expose your awesome D library via a dumped down C interface.
Jan 31
parent reply I =?UTF-8?B?TGluZHN0csO2bQ==?= <nota.real address.com> writes:
On Wednesday, 31 January 2018 at 12:56:31 UTC, Arredondo wrote:
 As other have said, WPF and C# is the way to go for Windows GUI 
 programming, but you don't necessarily need to drop D. You 
 could write your interface code in VS and have it call your D 
 library via pinvoke (Platform Invoke). To make this work you 
 must mark your public D functions with extern(C). Read the 
 documentation on extern(C) and PInvoke.

 Honestly, I don't know why more people don't do this. It really 
 seems to be like the best of both worlds, as C# + WPF is king 
 for Windows GUI and D is king for library development. The only 
 drawback I can think of is you have to expose your awesome D 
 library via a dumped down C interface.
This was an interesting idea. Thanks. And thank you all for your ideas and suggestions. I'll try some out and see what works.
Feb 01
parent Martin Tschierschke <mt smartdolphin.de> writes:
On Thursday, 1 February 2018 at 09:18:30 UTC, I Lindström wrote:
[...]
 And thank you all for your ideas and suggestions. I'll try some 
 out and see what works.
I found this useful: https://github.com/adamdruppe/arsd/blob/master/simpledisplay.d
Feb 02
prev sibling parent reply I =?UTF-8?B?TGluZHN0csO2bQ==?= <nota.real address.com> writes:
On Tuesday, 30 January 2018 at 05:56:51 UTC, DanielG wrote:
 There are far too many options for Windows GUI programming, so 
 we probably need a bit more information about any constraints 
 that are important to you.

 For example:

 - do you specifically want something that works well with D? or 
 are you open to other languages?

 - are you just wanting to learn desktop programming in general? 
 (Like the concepts involved) Or do you have a specific thing 
 you want to create?

 I would personally suggest Delphi to somebody who wants to 
 write Windows desktop apps and learn about event-driven 
 development, howeverrr the language (Object Pascal) is 
 insufferably archaic compared to something like D. But it is 
 definitely the cleanest, least-overwhelming method of writing 
 native Win32 applications for somebody with no prior experience.

 Then there's all the modern Microsoft stuff 
 (WPF/XAML/WinRT/etc), but you pretty much have to use either 
 .NET or C++ for that.
I have a specific thing I want to create and I could do it in a console but it'd be very clunky to use, but at the moment I need to learn the basic stuff for this. I'd like to use D as I've grown quite fond of it after my earlier attempts at first Perl, then Python, C++ and now D for the past year and a half. For some reason D feels the most... homey and comfortable of the languages I've tried.
Jan 30
parent aberba <karabutaworld gmail.com> writes:
On Tuesday, 30 January 2018 at 18:41:57 UTC, I Lindström wrote:
 On Tuesday, 30 January 2018 at 05:56:51 UTC, DanielG wrote:
 There are far too many options for Windows GUI programming, so 
 we probably need a bit more information about any constraints 
 that are important to you.

 For example:

 - do you specifically want something that works well with D? 
 or are you open to other languages?

 - are you just wanting to learn desktop programming in 
 general? (Like the concepts involved) Or do you have a 
 specific thing you want to create?

 I would personally suggest Delphi to somebody who wants to 
 write Windows desktop apps and learn about event-driven 
 development, howeverrr the language (Object Pascal) is 
 insufferably archaic compared to something like D. But it is 
 definitely the cleanest, least-overwhelming method of writing 
 native Win32 applications for somebody with no prior 
 experience.

 Then there's all the modern Microsoft stuff 
 (WPF/XAML/WinRT/etc), but you pretty much have to use either 
 .NET or C++ for that.
I have a specific thing I want to create and I could do it in a console but it'd be very clunky to use, but at the moment I need to learn the basic stuff for this. I'd like to use D as I've grown quite fond of it after my earlier attempts at first Perl, then Python, C++ and now D for the past year and a half. For some reason D feels the most... homey and comfortable of the languages I've tried.
There is a D GUI library called DlangUI at https://github.com/buggins/dlangui. The README file show some basic examples on how to use it. More demo apps are in the "examples" folder. Looking through those examples can really help. It works on windows and will work on Mac and Linux too. I use it on Linux and its quite impressive. Some people here have used it to develop commercial softwares. I'm in a process of learning and creating a much nicer theme for it. Not much progress for now.
Jan 30
prev sibling next sibling parent Guillaume Piolat <notthat email.com> writes:
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 The other way I've been thinking is to do the thing 
 browser-based, but for some reason that doesn't feel right.
Ironically the trick for native programming is to depend on the OS as less as possible, with a small "API surface".
Jan 30
prev sibling next sibling parent Kagamin <spam here.lot> writes:
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 I've been Googling a ton these past few days for some kind of a 
 book or a course on how to code desktop applications for 
 Windows, but either there isn't one, or it's very well hidden.
"Programming Windows" by Charles Petzold, 5th edition, 1998, The definitive developer's guide to the Windows 98 API. The book goes through the classic application development cycle and explanation of features.
Jan 30
prev sibling next sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 Hello all!

 I've been doing console apps for about a year and a half now, 
 but my requirements are reaching the limits of easy to use with 
 ASCII-based UI and typed commands so I'm thinking of moving 
 into GUI-era with my projects. I was wondering if some one 
 could help me into the right direction. I've been Googling a 
 ton these past few days for some kind of a book or a course on 
 how to code desktop applications for Windows, but either there 
 isn't one, or it's very well hidden. I've found bits and pieces 
 but nothing to give me a coherent approach.

 The other way I've been thinking is to do the thing 
 browser-based, but for some reason that doesn't feel right.
You may have a look at Delta https://forum.dlang.org/post/hpodoabutuakfxbzzcyy forum.dlang.org It is a solution to write a gui application using all the benefits Embarcadero Delphi RAD Studio gives you, while all of your coding is written in D. Kind regards Andre 13
Jan 30
prev sibling parent reply rumbu <rumbu rumbu.ro> writes:
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
 Hello all!

 I've been doing console apps for about a year and a half now, 
 but my requirements are reaching the limits of easy to use with 
 ASCII-based UI and typed commands so I'm thinking of moving 
 into GUI-era with my projects. I was wondering if some one 
 could help me into the right direction. I've been Googling a 
 ton these past few days for some kind of a book or a course on 
 how to code desktop applications for Windows, but either there 
 isn't one, or it's very well hidden. I've found bits and pieces 
 but nothing to give me a coherent approach.

 The other way I've been thinking is to do the thing 
 browser-based, but for some reason that doesn't feel right.
On Windows platform, WPF is the way to go right now. Once you accommodate yourself with XAML (descriptive language for designing windows and controls), you can step up from WPF to modern Windows apps (UWP). Unfortunately, none of these technologies are supported in D. WinAPI is for masochistic people, WinForms is obsolete. But we are leaving in the everything-is-an-web-app era, therefore don't dismiss the idea of an web application. I don't like them either.
Jan 31
parent reply John Chapman <johnch_atms hotmail.com> writes:
On Wednesday, 31 January 2018 at 11:52:20 UTC, rumbu wrote:
 On Windows platform, WPF is the way to go right now. Once you 
 accommodate yourself with XAML (descriptive language for 
 designing windows and controls), you can step up from WPF to 
 modern Windows apps (UWP). Unfortunately, none of these 
 technologies are supported in D.
Just to say that it is actually possible to write modern Windows apps in D - I've done it. WinRT is just COM. Granted it's not as easy as using Microsoft's language projections, but it's doable if you really want to.
Jan 31
parent DanielG <simpletangent gmail.com> writes:
On Wednesday, 31 January 2018 at 12:25:36 UTC, John Chapman wrote:
 Just to say that it is actually possible to write modern 
 Windows apps in D - I've done it. WinRT is just COM. Granted 
 it's not as easy as using Microsoft's language projections, but 
 it's doable if you really want to.
The .winmd files describing the WinRT API surface are machine-readable, so in theory some enterprising D developer should be able to generate an elegant D projection. But as with many things, there might not be much overlap between "those who can" and "those who want to" :P It's certainly beyond my skill level at the moment ...
Jan 31