-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
wxWidgets ImGui Wrapper #1029
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
Comments
I dont know how work the keyboard system with imgui. In wxiwdget, i have events keydown and char. the event EVT_CHAR get the final key with modifiers, so if i touch the key 'c' with no shift, i get 'c' and not 'C'. maybe imgui want the original char 'C' for detect the good key for launch the clipboard func ? because i see the line in the init : i have checked the clipboard with the test window. it work so my problem come from the ctrl+c who is not catch by imgui in think. i have tried the same process event like the directx sample but i have the same result, the clipboard is not catched. for imgui detect the "ctrl+c", we need to put the char c in the func "io.AddInputCharacter" and imgui use modifier state ? or its another way ? |
ImGui looks for the keydown state of C in |
ok i have resolved my issue.wx widgets have some problems about key cathing comparing to tohers systems |
i been trying to do something similar to this for some time, could you by any chance share this work for reference? Thank you. |
you have the files attached to the post... |
ahh silly me. thanks. |
I've made a platform backend for wxWidgets, which is quite usable with the existing OpenGL3 rendering backend. I also implemented my UI with on-demand rendering, so the Init takes a refresh callback, at which point you should re-render 2-3 times. I did this like this: if (!ImGui_ImplWX_Init([]()
{ // Two frames of updates necessary, even for mouse move
DearImGuiPanel *panel = wxGetApp().imGuiPanel;
panel->updateUI = std::max(panel->updateUI, 2);
panel->Refresh();
}))
return false; and void DearImGuiPanel::OnIdle(wxIdleEvent &event)
{
if (updateUI > 0)
Refresh();
} with this in setup: Bind(wxEVT_IDLE, &DearImGuiPanel::OnIdle, this);
Bind(wxEVT_KEY_DOWN, ImGui_ImplWX_OnKeyDown);
Bind(wxEVT_KEY_UP, ImGui_ImplWX_OnKeyUp);
Bind(wxEVT_CHAR_HOOK, ImGui_ImplWX_OnChar);
Bind(wxEVT_MOTION, ImGui_ImplWX_OnMouseMoveEvent);
Bind(wxEVT_MOUSEWHEEL, ImGui_ImplWX_OnMouseWheelEvent);
Bind(wxEVT_LEFT_DOWN, ImGui_ImplWX_OnMouseLeftEvent);
Bind(wxEVT_LEFT_UP, ImGui_ImplWX_OnMouseLeftEvent);
Bind(wxEVT_RIGHT_DOWN, ImGui_ImplWX_OnMouseRightEvent);
Bind(wxEVT_RIGHT_UP, ImGui_ImplWX_OnMouseRightEvent);
Bind(wxEVT_MIDDLE_DOWN, ImGui_ImplWX_OnMouseMiddleEvent);
Bind(wxEVT_MIDDLE_UP, ImGui_ImplWX_OnMouseMiddleEvent); and of course the Render method decreasing the counter. Also allows for fast OpenGL updates with a slower event-based UI update rate. Requires proper handling of external events (e.g. resizing) and updates from your code, ofc. Most everything is like the Dear ImGui examples suggest, e.g. for rendering: ImGui_ImplWX_NewFrame(this);
ImGui_ImplOpenGL3_NewFrame();
ImGui::NewFrame(); Here's the implementation: Example (at this point, I only had the console left as the only native control, but it integrated well with Menus and other UI controls overlapping with the GLCanvas) |
what is the interest to use wxWidgets but dont use wxWidgets Gui ? |
For me it was a transition period where I wasn't sure to what extent I was going to use ImGui (e.g. just for overlay over the 2D and 3D GLCanvases, or to replace all). Especially since I still had plans to use some cross-platform desktop integration features of wxWidgets so I had to keep it around anyway until I found replacements. |
Hello,
this is not an issue i think.
i tried to create a wrapper of imgui in wxWidgets.
it work more or less, but i have problem with clipboard. he is not catched. i have the good modifiers but with custom func or not i not arrive to resolve the problem.
can you check my code and say if you see somethings, can explain the problem please ?
thanks, i work on from many day...
wxImGuiCanvas.h.txt
wxImGuiCanvas.cpp.txt
The text was updated successfully, but these errors were encountered: