Skip to content
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

Create new folder directly from FolderDialog #3174

Closed
2 tasks done
Beebeeoii opened this issue Aug 3, 2022 · 3 comments · Fixed by #3178
Closed
2 tasks done

Create new folder directly from FolderDialog #3174

Beebeeoii opened this issue Aug 3, 2022 · 3 comments · Fixed by #3178
Labels
enhancement New feature or request FileDialog Improvements to the builtin file dialogs

Comments

@Beebeeoii
Copy link
Contributor

Checklist

  • I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
  • This issue only relates to a single feature. I will open new issues for any other features.

Is your feature request related to a problem?

I have tried searching through all issues but am unable to find any that addresses this. The closest I found is #2981 but it is not exactly the same.

Currently, the FolderDialog seems to lack the feature of creating a new folder to be selected. For example, if the directory /Users/me/ exists, but I want to select the folder /Users/me/folder which does not already exist, I would have to create the folder separately first before selecting it from the FolderDialog.

Is it possible to construct a solution with the existing API?

I believe it is possible to add this functionality via FileDialog. What I have in mind is something along of the lines shown below.

type fileDialog struct {
        ...
        newFolder        *widget.Button
        ...
}
f.newFolder = widget.NewButton(label, func() {
        // Get curr dir via f.dir
        // Create folder via os.Mkdir
        // Refresh dialog
})

Describe the solution you'd like to see.

As proposed above.

@Jacalz Jacalz added enhancement New feature or request FileDialog Improvements to the builtin file dialogs labels Aug 3, 2022
@andydotxyz
Copy link
Member

Nice idea

Jacalz pushed a commit that referenced this issue Aug 25, 2022
This PR introduces the ability to create new folder directly from the file/folder dialog. This is motivated by the hassle of having to create a folder separately before being able to select it via the folder dialog.

Changes were made to makeUI() to include a create folder button in the options container which would open up a entry form dialog for user to input the new folder name before executing the mkdir syscall. Directory is then refreshed to enable user to select the newly created folder.

Fixes #3174
@ChandanChainani
Copy link
Contributor

ChandanChainani commented Sep 29, 2022

@andydotxyz it seem the issue is resolved please can you close this and related issues

@Jacalz Jacalz closed this as completed Sep 29, 2022
@Jacalz
Copy link
Member

Jacalz commented Sep 29, 2022

Good point. Thanks for notifying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request FileDialog Improvements to the builtin file dialogs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants