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

Flags are not modifiable after construction #25

Closed
cianjinks opened this issue Sep 25, 2020 · 2 comments
Closed

Flags are not modifiable after construction #25

cianjinks opened this issue Sep 25, 2020 · 2 comments

Comments

@cianjinks
Copy link

cianjinks commented Sep 25, 2020

Title says it all. I am wondering why there is no ImGui::FileBrowser::GetFlags() function or a ImGui::FileBrowser::SetFlags(ImGuiFileBrowserFlags flags) function? Instead it can only be done upon construction of the browser object.

For my case I want to be able to save and load things and when saving I want to enable the entering of a file name and when loading I do not. To do so should I be creating a different file browser for each?

@AirGuanZ
Copy link
Owner

We can implement the same function with assignment operator. For example:

FileBrowser fileBrowser;
// ... do other stuff
fileBrowser = FileBrowser(ImGuiFileBrowserFlags_SelectDirectory);

The disadvantage is that title, dialog size and current directory are not kept with the new browser. However, we can set it manually:

FileBrowser fileBrowser;
// do other stuff
const auto dir = fileBrowser.GetPwd();
fileBrowser = FileBrowser(ImGuiFileBrowserFlags_SelectDirectory);
fileBrowser.SetPwd(dir);

I will consider adding a SetFlags soon.

@cianjinks
Copy link
Author

Thank you, I'll consider using that for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants