-
-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Select Folder type of Dialog #47
Comments
Well, it seems to be necessary a pull request for this in https://github.com/parro-it/libui-node and https://github.com/andlabs/libui :/ I've already take a look at the files needed to implement a new method for this in libui, it would be necessary to modify these files: darwin: https://github.com/andlabs/libui/blob/86c4485578d6d58aff6528b27558bc1ccc6aadbe/darwin/stddialogs.m unix: https://github.com/andlabs/libui/blob/86c4485578d6d58aff6528b27558bc1ccc6aadbe/unix/stddialogs.c Don't know if there is any other needed, probably I may need to expose this somewhere. |
Probably two new types are needed:
because on all platforms, you have to select one type (i.e. |
There was already a pull request for openFolder (closed): andlabs/libui#190 |
@mischnic nice to know this, maybe I can build a PR up on this, but I didn't found it in the master branch if I can recall (I need to take a look again..). Maybe it was removed later? EDITSorry, now I see that the PR was rejected. I'll start the discussion again on why this was made. |
I didn't reject the PR. I decided to hold off on merging it, because the current APIs for dialogs isn't ideal. It all has to do with event handling and synchronicity. I'll use pseudocode in JavaScript to explain what I mean (this will probably be easier than explaining it in C in the main repo, to be honest...). On Windows, the system dialog API only gives me one option: var selectedItem = runDialog(parentWindow); You'll notice this function does not return until the dialog is dismissed. You'll notice that a parent window must be specified. Clicking on that window while the dialog is open will cause that window to flash. Other windows can still be interacted with, but they will NOT respond to things like tab navigation. This is because tab navigation on Windows is intrinsically tied to dialog boxes! Specifically, the I could also disable all the windows during the dialog's lifetime, but then clicking on those other windows won't flash the dialog window (and I don't think I have a way to do this myself at all...). Now I could theoretically use a dialog message hook to try to work around this, but I'm not sure if this solution might be flaky (I would have to write it). I have tried to deduce what the correct programming model on Windows is based on all this information, even going so far as to ask outright, but I can't get an answer out. Failure to provide a parent window will cause Windows to not flash the dialog window when clicking other windows. GTK+ is the nicest of the bunch, as I have two options: var selectedItem = runDialog(parentWindow);
openDialog(parentWindow).then((selectedItem) => {
// ...
}); The former will prevent interaction with any window during the dialog's lifetime, but in a weird some-of-the-events-still-go-through way. I also can't do any custom main loops with this option. The latter will let you interact with everything else in the program while the dialog is running. I don't remember if there were caveats, but notice you still need to provide a window to disable while the dialog is running. In both cases, failure to provide a parent window will do nothing but cause GTK+ to spit the dreaded macOS is only slightly less nice: var selectedItem = runDialog();
openDialog(parentWindow).then((selectedItem) => {
// ...
}); In the former case, the dialog is global to the application, and all window interaction is blocked until the dialog is dismissed. I also can't do any custom main loop stuff. In the latter case, the dialog is modal to to a specific window, and appears as a "sheet" that pulls down from the titlebar. You can still interact just fine with other windows, under certain circumstances. While custom main loops are still possible, this approach probably tells NSApplication to run in a different main loop run mode which might affect things. I need to read more on how NSApplication and sheets work together before I can make a verdict here. Also, you must provide a parent window in this case. So hopefully that explains the dilemma. |
New issue tracking progress: andlabs/libui#314 |
Proton Native V2 is now released! If the issue still occurs in the new update, please open a new issue. |
Feature Request
Currently, when using the
Dialog
method, we can use the DialogTypeEnum to determine if we want a dialog for:Well, it turns out that sometimes we want the user to also select a folder instead of a file. So I would like to propose a new DialogType:
User Story
As a user,
I want to be able to select a folder,
In order to select the destiny of a generated file, for example.
As a developer,
I want to be able to popup a Dialog to request a folder destiny to the user,
In order to get the path I should use as destiny of a generated file, for example.
(I'm no good at writing user stories, but well, I tried)
The text was updated successfully, but these errors were encountered: