Skip to content

ModalDialog doesn't function intended #372

@ThePhoenixFox

Description

@ThePhoenixFox

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions