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

ModalDialog doesn't function intended #372

Open
ThePhoenixFox opened this issue Jul 2, 2024 · 0 comments
Open

ModalDialog doesn't function intended #372

ThePhoenixFox opened this issue Jul 2, 2024 · 0 comments

Comments

@ThePhoenixFox
Copy link

Multiple issues with ModalDialog from "extensions/olcPGEX_QuickGUI.h"
I tried using ModalDialog in my application but I keep getting runtime errors.

Issues:
Directories that are user protected (no read access) if entered, throw an std::filesystem::filesystem_error for illegal access.
Backspace doesn't update the list boxes for directories or files.
UI doesn't update to screen size.
Input are not easy to know unless you see the code.
List will clamp value when updated possibly putting multiple paths ahead of the intended path.
Example:
root -> 7 dirs
dir 1 -> 5 dirs
dir 2 -> 1 dir
dir 3 -> 0 dirs
It will go to dir 3 right away because the nSelectedItem is clamped to vector size which decreases in each directory causing the bSelectionChanged be true even though the user didn't select anything.

Possible Fixes:
Instead of putting all directories into the vector, only allow ones with read permission using

std::filesystem::file_status temp = std::filesystem::status(dir.path());
std::filesystem::perms dirPerms = temp.permissons();
if(dirPerms & std::filesystem::perms::owner_read)
 vector.push_back(dir.path().string());

Make a new function for updating list

private:
 void UpdateList();

UI: Good luck

Input a few buttons as well a keybinds so we don't need to tell them to Backspace to go to parent or Esc to escape
ListBox should be given a new variable

public:
 bool bHasInteracted = false;

Thanks for the great videos as well!

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

1 participant