www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - UI Library

reply harakim <harakim gmail.com> writes:
I need to write a piece of software to track and categorize some 
purchases. It's the kind of thing I could probably write in a 

something keeps drawing me to D and as this is a simple 
application, it would be a good one to get back in after almost a 
year hiatus.

For this, I need a UI library to use. I need text inputs, buttons 
and that sort of thing. My My order of preference is:
1. Native component library that works on linux and windows
2. Something like SDL
3. Native component library that works on linux or windows
4. vibe.d + web

I mostly value that it works over lots of functionality and 
stability over the way the UI looks. Is there an obvious native 
application component library to use? If not, is bindbc the best 
way to go for the sdl-like option? I think I can figure out 
option Vibe.d if there are no good non-web solutions.

PS I'm surprised the forum search didn't turn up topics about 
desktop applications or UI libraries because I know I've seen 
them.
May 19 2022
next sibling parent reply Craig Dillabaugh <craig.dillabaugh gmail.com> writes:
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 I need to write a piece of software to track and categorize 
 some purchases. It's the kind of thing I could probably write 

 something keeps drawing me to D and as this is a simple 
 application, it would be a good one to get back in after almost 
 a year hiatus.

 [...]
Maybe you can use minigui from arsd https://github.com/adamdruppe/arsd
May 19 2022
parent reply harakim <harakim gmail.com> writes:
On Friday, 20 May 2022 at 02:53:39 UTC, Craig Dillabaugh wrote:
 On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 I need to write a piece of software to track and categorize 
 some purchases. It's the kind of thing I could probably write 

 However, something keeps drawing me to D and as this is a 
 simple application, it would be a good one to get back in 
 after almost a year hiatus.

 [...]
Maybe you can use minigui from arsd https://github.com/adamdruppe/arsd
Thank you. I will definitely give that a try.
May 19 2022
parent reply Adam D Ruppe <destructionator gmail.com> writes:
On Friday, 20 May 2022 at 03:47:14 UTC, harakim wrote:
 Thank you. I will definitely give that a try.
My minigui uses the normal Windows controls so it works well there. On linux it uses a custom thing of my own design so your mileage may vary. The docs don't have a lot of examples but hopefully one you do the first one the rest won't be too hard, the classes are relatively simple and the events are based on javascript so if you've used that before you can probably get to know it. But just ask me if something comes up since I can push fixes to master p quickly. The only files it needs from the repo are `minigui.d`, `simpledisplay.d` and `color.d`. There's other optional things in there that might be useful though. My recommended way to use it is to `git clone` the repo in your source dir then `dmd -i yourfile.d` so it is easy to update with a `git pull` and the compiler pulls what it needs (and nothing more) automatically when compiling. But you can also do it yourself or use the dub packages etc.
May 20 2022
next sibling parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
Avoid GTK, it's bloated, GTK4 looks like a toolkit to design 
mobile apps, and you need runtime dependencies on windows

adam's gui library is very nice, 0 dependencies

I personally prefer IMGUI, 0 dependencies, you bring the 
windowing library of your choice, i pick GLFW since it's minimal

IMGUI is fully capable, someone made a Spotify client with it!

https://user-images.githubusercontent.com/3907907/81094458-d20d9200-8f03-11ea-81e0-e72c0063b3a7.png
May 20 2022
parent reply Jack <jckj33 gmail.com> writes:
On Friday, 20 May 2022 at 12:32:37 UTC, ryuukk_ wrote:
 Avoid GTK, it's bloated, GTK4 looks like a toolkit to design 
 mobile apps, and you need runtime dependencies on windows

 adam's gui library is very nice, 0 dependencies

 I personally prefer IMGUI, 0 dependencies, you bring the
could you send me please the link for this lib?
 windowing library of your choice, i pick GLFW since it's minimal

 IMGUI is fully capable, someone made a Spotify client with it!

 https://user-images.githubusercontent.com/3907907/81094458-d20d9200-8f03-11ea-81e0-e72c0063b3a7.png
May 27 2022
parent Sergey <kornburn yandex.ru> writes:
On Saturday, 28 May 2022 at 02:39:41 UTC, Jack wrote:
 On Friday, 20 May 2022 at 12:32:37 UTC, ryuukk_ wrote:
 Avoid GTK, it's bloated, GTK4 looks like a toolkit to design 
 mobile apps, and you need runtime dependencies on windows

 adam's gui library is very nice, 0 dependencies

 I personally prefer IMGUI, 0 dependencies, you bring the
could you send me please the link for this lib?
 windowing library of your choice, i pick GLFW since it's 
 minimal

 IMGUI is fully capable, someone made a Spotify client with it!

 https://user-images.githubusercontent.com/3907907/81094458-d20d9200-8f03-11ea-81e0-e72c0063b3a7.png
There are several bindings. https://code.dlang.org/search?q=Imgui
May 28 2022
prev sibling next sibling parent harakim <harakim gmail.com> writes:
On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote:
 The docs don't have a lot of examples but hopefully one you do 
 the first one the rest won't be too hard, the classes are 
 relatively simple and the events are based on javascript so if 
 you've used that before you can probably get to know it.

 But just ask me if something comes up since I can push fixes to 
 master p quickly.
Your libraries and code samples have always been really simple to understand. I'll let you know if I find anything that doesn't make sense. On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote:
 My minigui uses the normal Windows controls so it works well 
 there. On linux it uses a custom thing of my own design so your 
 mileage may vary.
I will probably use this exclusively on Windows for a long time to come, so I can cross that bridge when I get there.
May 21 2022
prev sibling parent reply harakim <harakim gmail.com> writes:
On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote:
 On Friday, 20 May 2022 at 03:47:14 UTC, harakim wrote:
 Thank you. I will definitely give that a try.
But just ask me if something comes up since I can push fixes to master p quickly.
I have been using the minigui library and it's working well for me. Thank you for creating it. I decided to throw together a bar chart, but it has been was more complicated than I gave it credit for. I am breaking it up into multiple nested widgets. The issue I'm having is that I don't understand how to assign bounds in the nested widget. I'm sure there's a very clean solution. I basically want a paintContent method but with the bounds dynamically assigned by the parent. My thought is: 1. Create a setBounds on the child 2. Call setBounds on the child from inside paintContent of the parent 3. Instead of using paintContent in the child, use paint and use the bounds specified there but that seems kind of off because I pass the bounds from parent to child separate from having the bounds in the child and it is not intuitive that the bounds would always be set by the parent before the child is painted. If there is a more elegant solution, then I will use it. Otherwise, this solution will work fine with some comments.
Jun 10 2022
next sibling parent reply harakim <harakim gmail.com> writes:
On Saturday, 11 June 2022 at 01:20:17 UTC, harakim wrote:
 On Friday, 20 May 2022 at 12:07:46 UTC, Adam D Ruppe wrote:
 On Friday, 20 May 2022 at 03:47:14 UTC, harakim wrote:
 Thank you. I will definitely give that a try.
But just ask me if something comes up since I can push fixes to master p quickly.
If there is a more elegant solution, then I will use it. Otherwise, this solution will work fine with some comments.
I tried the solution I suggested and it did not work because the child would occlude the parent (which is in the comments now that I see it.) I decided to stick to simpledisplay strictly and forgo using the minigui library for the time being, and that is working well.
Jun 11 2022
parent Adam D Ruppe <destructionator gmail.com> writes:
On Saturday, 11 June 2022 at 21:44:17 UTC, harakim wrote:
 I tried the solution I suggested and it did not work because 
 the child would occlude the parent (which is in the comments 
 now that I see it.)
yeah minigui's model is to tile the widgets; they aren't supposed to overlap (except their parent, but then they cover the parent)
 I decided to stick to simpledisplay strictly and forgo using 
 the minigui library for the time being, and that is working 
 well.
Yeah, nested widgets are something i sometimes use btu more often then not, i'll make the whole display for a thing - say a graph - just be a single widget and paint it in there. A simpledisplay window's paint code can generally be pasted into a single minigui widget's paint code without much modification (the minigui WidgetPainter actually is a subclass of simpledisplay's ScreenPainter)
Jun 11 2022
prev sibling parent reply Adam D Ruppe <destructionator gmail.com> writes:
On Saturday, 11 June 2022 at 01:20:17 UTC, harakim wrote:
 The issue I'm having is that I don't understand how to assign 
 bounds in the nested widget. I'm sure there's a very clean 
 solution. I basically want a paintContent method but with the 
 bounds dynamically assigned by the parent.
Well the bounds given to paintContent just define your content area boundaries, relative to the nested widget. The content area is inside its own border. The actual position is assigned by the parent (the virtual function there is recomputeChildLayout, you can override that to arrange instead of letting it automatically fill the space). I don't really know what exactly you have in mind for the bounds, but anything outside your widget area is going to be clipped anyway, so I think you really want to change that child layout computation.
Jun 11 2022
parent harakim <harakim gmail.com> writes:
On Saturday, 11 June 2022 at 21:50:47 UTC, Adam D Ruppe wrote:
 On Saturday, 11 June 2022 at 01:20:17 UTC, harakim wrote:
 The issue I'm having is that I don't understand how to assign 
 bounds in the nested widget. I'm sure there's a very clean 
 solution. I basically want a paintContent method but with the 
 bounds dynamically assigned by the parent.
Well the bounds given to paintContent just define your content area boundaries, relative to the nested widget. The content area is inside its own border. The actual position is assigned by the parent (the virtual function there is recomputeChildLayout, you can override that to arrange instead of letting it automatically fill the space).
The recomputeChildLayout method is the answer I was looking for. You describe copying the paint method into the paint content method. I did the exact opposite and copied from the paintContent method to the paint method and it worked. I am getting pretty comfortable with using simple display, but I will probably look to minigui in the future. This application is just for me to use so I don't need interactive buttons and so forth. Thanks for making these libraries available. I'm also using your sqllite and http2 modules so far. :)
Jun 16 2022
prev sibling next sibling parent reply Tejas <notrealemail gmail.com> writes:
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 I need to write a piece of software to track and categorize 
 some purchases. It's the kind of thing I could probably write 

 something keeps drawing me to D and as this is a simple 
 application, it would be a good one to get back in after almost 
 a year hiatus.

 [...]
Maybe gtkd? https://code.dlang.org/packages/gtk-d
May 20 2022
parent Mike Parker <aldacron gmail.com> writes:
On Friday, 20 May 2022 at 07:05:21 UTC, Tejas wrote:

 Maybe gtkd?
 https://code.dlang.org/packages/gtk-d
And some corresponding tutorials: https://gtkdcoding.com/
May 20 2022
prev sibling next sibling parent zjh <fqbqrr 163.com> writes:
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 
`winrt` may be good. but `winrtd` has many bugs.
May 20 2022
prev sibling next sibling parent reply drug <drug2004 bk.ru> writes:
On 20.05.2022 05:37, harakim wrote:
 I need to write a piece of software to track and categorize some 
 purchases. It's the kind of thing I could probably write in a couple of 

 me to D and as this is a simple application, it would be a good one to 
 get back in after almost a year hiatus.
 
 For this, I need a UI library to use. I need text inputs, buttons and 
 that sort of thing. My My order of preference is:
 1. Native component library that works on linux and windows
 2. Something like SDL
 3. Native component library that works on linux or windows
 4. vibe.d + web
 
 I mostly value that it works over lots of functionality and stability 
 over the way the UI looks. Is there an obvious native application 
 component library to use? If not, is bindbc the best way to go for the 
 sdl-like option? I think I can figure out option Vibe.d if there are no 
 good non-web solutions.
D port of minimalistic gui library for OpenGL https://github.com/drug007/nanogui
 
 PS I'm surprised the forum search didn't turn up topics about desktop 
 applications or UI libraries because I know I've seen them.
You can select category in dub (code.dlang.org) to get something like this: https://code.dlang.org/?sort=updated&limit=20&category=library.gui
May 20 2022
parent harakim <harakim gmail.com> writes:
On Friday, 20 May 2022 at 08:03:10 UTC, drug wrote:
 You can select category in dub (code.dlang.org) to get 
 something like this:
 https://code.dlang.org/?sort=updated&limit=20&category=library.gui
Thanks. I'm still kind of new to dub so I didn't know this existed! I'm glad there are multiple options that look like they'd do the job.
May 21 2022
prev sibling next sibling parent Marcone <thegrapevine email.com> writes:
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 I need to write a piece of software to track and categorize 
 some purchases. It's the kind of thing I could probably write 

 something keeps drawing me to D and as this is a simple 
 application, it would be a good one to get back in after almost 
 a year hiatus.

 [...]
QtE5 https://github.com/MGWL/QtE5
Jun 10 2022
prev sibling parent Marcone <thegrapevine email.com> writes:
On Friday, 20 May 2022 at 02:37:48 UTC, harakim wrote:
 I need to write a piece of software to track and categorize 
 some purchases. It's the kind of thing I could probably write 

 something keeps drawing me to D and as this is a simple 
 application, it would be a good one to get back in after almost 
 a year hiatus.

 [...]
Qt Creator + Dlang: https://youtu.be/TFN5P4eoS_o
Jun 10 2022