Flix01 / imgui

Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
https://github.com/Flix01/imgui/wiki/ImGui-Addons-Branch-Home
MIT License
396 stars 34 forks source link

Is there any way to popup chooseFileDlg by pressing menuItem in MainMenuBar? #47

Closed damekko closed 5 years ago

damekko commented 5 years ago

I tried to call "dlg.chooseFileDialog(true); " directly, but no response.

damekko commented 5 years ago

it is done! just put dlg.chooseFileDialog in imgui window block, and use a boolean value as trigger.

Flix01 commented 5 years ago

It's done!

Nice! :smiley:

For others, as I've already explained it in another post (https://github.com/Flix01/imgui/issues/19), this snippet should work:

        bool browseButtonPressed = false;
        if (ImGui::BeginMenu("File"))   {
            browseButtonPressed = ImGui::MenuItem("Open...", "CTRL+O");
            ImGui::EndMenu();
        }
        static ImGuiFs::Dialog dlg;
        const char* chosenPath = dlg.chooseFileDialog(browseButtonPressed);