Replies: 40 comments
-
This is best done using platform code; Probably outside the scope of the library? I'm not sure. |
Beta Was this translation helpful? Give feedback.
-
Not sure about other systems, but Windows has a set of predefined modal dialogs https://docs.microsoft.com/en-us/windows/win32/dlgbox/dialog-box-types You just call an API function and it creates a modal window managed by the OS, the function will return (with user data) when the window is closed. |
Beta Was this translation helpful? Give feedback.
-
All platforms have those. It might be good to abstract this in a cross-platform API, but I am not sure where to draw the line which elements should support. How this is triggered is App specific. It can be from a menu, a button, etc. |
Beta Was this translation helpful? Give feedback.
-
True, I was thinking more about providing such platform-abstracted API so one can easily create a custom widget and do something like |
Beta Was this translation helpful? Give feedback.
-
Agreed. Probably worth looking into. |
Beta Was this translation helpful? Give feedback.
-
I'm in the process of looking how other GUI libraries handle this and designing a common OS-agnostic API. Windows and macOS interfaces are rather rich - what should I be looking at for unix systems? GTK+ 3 API? |
Beta Was this translation helpful? Give feedback.
-
I started making a sheet which compares major OS APIs and libraries (Windows, Mac, GTK+ 3, wxWidgets 3, Qt 5). Turns out all of them have very rich set of settings. Core functionality like path filtering, default file/dir are present in all. For each of other/advanced options, it is present on most targets. Both Qt and wxWidgets cover almost all and ignore specific ones on platforms on which they are not available. IMO this is a very good design. The eventual interface in elements can be a free function that takes 1 parameter: options struct. This way:
|
Beta Was this translation helpful? Give feedback.
-
Yes GTK3 on Linux |
Beta Was this translation helpful? Give feedback.
-
Sounds good to me! I suggest starting basic. It's always easy to add APIs than to remove APIs, especially when the library gets established. |
Beta Was this translation helpful? Give feedback.
-
This is going to take some time, but I can share my WIP spreadsheet if you want. |
Beta Was this translation helpful? Give feedback.
-
Google sheet will be good. |
Beta Was this translation helpful? Give feedback.
-
Actually, it's easier for me to work on the spreatsheet offline. I already switch too many browser tabs too often when reading various documentation. I can upload it here when I finish. |
Beta Was this translation helpful? Give feedback.
-
These are all of my current notes on all 3 filesystem dialogs:
|
Beta Was this translation helpful? Give feedback.
-
Wow, that's a lot! Nice work collecting that. So basically, as always: Start with a minimal subset that is available on all platforms. (BTW. I wonder how you are able to test on MacOS, do you have a Mac you can work on?) |
Beta Was this translation helpful? Give feedback.
-
I'm not able to test it on mac. I don't even have Obj-C skills. All from the sheet is from API documentation. I will left Mac implementation for you. |
Beta Was this translation helpful? Give feedback.
-
You might want to look: 02f50e1 |
Beta Was this translation helpful? Give feedback.
-
auto scale = 1.0; ??? Are you testing on visual studio on a HDPI machine? It will give me a lot of work if you are not. I respect your decision to use gcc, but keep in mind that this is not the mainstream compiler on Windows. |
Beta Was this translation helpful? Give feedback.
-
Sure, but keep the header private. I usually do it in the same directory where the sources are and use include "some_util.hpp"
No promises, but I'll see if I can give that top priority. Is it in the experimental branch already? If not please do. |
Beta Was this translation helpful? Give feedback.
-
Of course these changes are not intended for the actual commit. I always revert any patches like this one but this time the area where the work is being done is conflicting with the patch so I just commited it and will then revert it when the full PR is ready. Also, I don't have any HDPI device for such testing. All of the commited scaling changes are irrelevant for the issue, they are just to be able to compile with MinGW which does not (yet) have this API implemented. I could actually contact MinGW runtime devs and check/ask why this API is not yet complete. It's not that much new. Initially I thought the thing is already done as I used a bit older installation and didn't wanted to bother you with MinGW ifdef PRs but now I see that it might take more time than I expected. I will check the situation - I know that many of the MinGW stuff is autogenerated so it is either simple overlook on their side or there is a bigger issue behind.
Good to read this, you seemed recently to kind of ignore this issue and I'm fighting with for a long time already. Pushed it and now the HEAD of experimental has the sample tab implementation (with a very bad drawing implementation). Also note that during experimenting I discovered #98 which might be related some bigger problems (eg weird behavior of stretching). |
Beta Was this translation helpful? Give feedback.
-
I am not ignoring the issue. There's just higher priority work already in the pipeline. |
Beta Was this translation helpful? Give feedback.
-
Right now, documentation is my highest priority. But as I said, I can step back a bit and give what you need some priority. |
Beta Was this translation helpful? Give feedback.
-
That is fine, as long as you are testing on Visual Studio too. You can't ignore that compiler if you are serious on working on cross-platform libraries. |
Beta Was this translation helpful? Give feedback.
-
I have made a sample implementation for Windows and Linux and now want to iterate over the options and what to do with them. I'm interested in your opinion on each of them. The core API: Core notes:
Now, for the each option:
|
Beta Was this translation helpful? Give feedback.
-
Wow, that is very comprehensive! I'll give a thorough reading and thinking as soon as I can (maybe replying to one item at a time -- i don't have enough time right now). |
Beta Was this translation helpful? Give feedback.
-
If the code requires You might want to look at the base_view instead, which is the basis of all elements' components. The handle that base_view is given IS-A child-window (in windows parlance) and a widget (in gtk parlance) and a content-view (in MacOS parlance). |
Beta Was this translation helpful? Give feedback.
-
To open a dialog (that is modal), each platform requires its own window handle. We can't really bypass this requirement, unless the user wants a non-modal dialog. I haven't checked, but it seems that |
Beta Was this translation helpful? Give feedback.
-
The MacOS solution for such things is to place the strings in resource files (like the config thing again). That way, localization is a simple config edit. Localization is not limited to just the names of such dialogs elements, although yeah, common UI elements are already localized in MacOS. But localization involves the whole app! So here's another use-case for that json thing again. At the very least, we assume that strings are UTF8. But it does not end with strings only, you'll also have to deal with other resources such as fonts, for example. |
Beta Was this translation helpful? Give feedback.
-
That makes sense. |
Beta Was this translation helpful? Give feedback.
-
I would like to make some summary about a filedialog widget, which seems what is discussed in this issue. TLDR: we could use an external native filedialog library and use it with a wrapper from Elements. I would like also to point out that the issue title is a bit generic, there can be also widgets for browsing files to be embedded in the application, for example:
Another discussed (elsewhere) point was in the audio context: GTK3 cannot be used because ABI issues between host and plugins, ergo no GtkFileChooser directly (see below). There are various solutions that implements, where possible, a native filedialog: Most of them use native API for macOS and Windows, where for Linux/BSD the solution is a bit more complex and a simple implementation was by using external shell based programs like Zenity (GTK) or KDialog (Qt/KDE) (adopted also by VSTGUI), though a proper solution would be by using XDG Desktop Portal FileChooser, which was implemented recently by falktx in his DISTRHO framework. |
Beta Was this translation helpful? Give feedback.
-
I think this makes sense. |
Beta Was this translation helpful? Give feedback.
-
This issue is for tracking any decisions before implementing this widget.
on_click
functionBeta Was this translation helpful? Give feedback.
All reactions