File Dialog stops working after moving to docking branch.
andreistan26 opened this issue · 3 comments
After moving to imgui/docking branch, the file dialog stops working.
I have a simple example implemented. The code works with the master branch.
Behavior: The button does nothing.
ImGui::Begin("File Browser");
int my_image_width, my_image_height;
if (ImGui::Button("Browse Files"))
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".png, .jpg, .jpeg", ".");
if (ImGuiFileDialog::Instance()->Display("ChooseFileDlgKey"))
{
if (ImGuiFileDialog::Instance()->IsOk())
{
filename = ImGuiFileDialog::Instance()->GetFilePathName();
LayerLoadTextureFromFile(filename.c_str(), &my_image_texture, &my_image_width, &my_image_height);
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
}
ImGuiFileDialog::Instance()->Close();
}
ImGui::End();
`
OS: Ubuntu 20.04
why are you doint a ImGui::Begin("File Browser"); ?
you need to understand who ImGuiFileDialog is working.
you can have you button for open a dailog between an ImGui::Begin("File Browser") and Imgui::End().
but not for the ImGuiFileDialog::Instance()->Display who wil open a custom begin.
check the sample app if you want.
you can cehck also https://github.com/aiekick/ImGuiFontStudio who is using ImGuiFileDialog with docking branch
Thanks for the advice! Tho i was not able to get it to work, it seems that just changing the branch makes the dialog to not work. I am using sdl/opengl3.
As soon as i change the branch to master the dialog works.
the dialog is working perfectly in docking branch, just you are not using it correctly in your code
and i think you not understand how docking branch is working too i guess.
your use of ImGuiFileDialog cant work in docking branch like the way your are using it in your code.
its normal