Skip to content

Commit

Permalink
Demo: mention ImFileDialog limitations (cf #294)
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Dec 12, 2024
1 parent 14602e6 commit 2122066
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
14 changes: 12 additions & 2 deletions bindings/imgui_bundle/demos_cpp/demo_widgets.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Part of ImGui Bundle - MIT License - Copyright (c) 2022-2024 Pascal Thomet - https://github.com/pthom/imgui_bundle
#include "hello_imgui/hello_imgui.h"
#include "hello_imgui/icons_font_awesome_4.h"
#include "imspinner/imspinner.h"
#include "imgui_toggle/imgui_toggle.h"
#include "imgui_toggle/imgui_toggle_presets.h"
Expand Down Expand Up @@ -298,9 +299,18 @@ void DemoImFileDialog()

ImGuiMd::RenderUnindented(R"(
# ImFileDialog
[ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui, with images preview.
*Not (yet) adapted for High DPI resolution under windows*
[ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui.
)");
ImGui::SameLine();
ImGui::Text(ICON_FA_EXCLAMATION_TRIANGLE);
ImGui::SetItemTooltip(
"It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform, "
"as well as notifications and messages.\n\n"
"Known limitations of ImFileDialog:\n"
" * Not adapted for High DPI resolution under windows\n"
" * No support for multi-selection\n"
" * Will not work under python with a pure python backend (requires to use `immapp.run()`)"
);

if (ImGui::Button("Open file"))
ifd::FileDialog::Instance().Open(
Expand Down
17 changes: 14 additions & 3 deletions bindings/imgui_bundle/demos_python/demo_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
immapp,
ImVec4,
im_cool_bar,
icons_fontawesome,
)
from imgui_bundle import imgui_command_palette as imcmd
from imgui_bundle import portable_file_dialogs as pfd
Expand Down Expand Up @@ -270,14 +271,24 @@ def demo_imfile_dialog():
if not has_submodule("im_file_dialog"):
return
from imgui_bundle import im_file_dialog as ifd

imgui_md.render_unindented(
"""
# ImFileDialog
[ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui, with images preview.
*Not (yet) adapted for High DPI resolution under windows*
[ImFileDialog](https://github.com/pthom/ImFileDialog.git) provides file dialogs for ImGui.
"""
)
# Warning / low support
imgui.same_line()
imgui.text(icons_fontawesome.ICON_FA_EXCLAMATION_TRIANGLE)
imgui.set_item_tooltip("""
It is advised to use Portable File Dialogs instead, which offer native dialogs on each platform,
as well as notifications and messages.
Known limitations of ImFileDialog:
* Not adapted for High DPI resolution under windows
* No support for multi-selection
* Will not work under python with a pure python backend (requires to use `immapp.run()`)
""")

if imgui.button("Open file"):
ifd.FileDialog.instance().open(
Expand Down

0 comments on commit 2122066

Please sign in to comment.