-
-
Notifications
You must be signed in to change notification settings - Fork 135
FAQ
In this chapter you find many issues, new users may face with.
Work in progress! Feel free to post any suggestions in this issue
Q: What is Master Window (giu.MasterWindow
)?
A: Master Window is a native application window in you OS.This is hosted (currently)
by GLFW. Master window is a workspace for imgui windows created by giu.
Q: Is there a way to open two (or more) Master Windows?
A: No. Current implementation does not allow to have more than one native windows in paralel.
You can however have many imgui windows.
Q: What is Run function? A: It is the most important method of "MasterWindow". You use this to specify, which function should be treated as loop function.
Q: So what is the loop
function?
A: This function is responsible for doing everything about imgui.
Its may task is to draw widgets that will be visible in MasterWindow.
For more details, refer to examples
Q: How to close Master Window from code?
A: There is (*MasterWindow).Close()
method. You can also use (*MasterWindow).SetShouldClose(true)
Q: How to use (*MasterWindow).SetCloseCallback
?
A: Use it before calling Run
. func() bool
argument, is a callback
called, whnever window needs to be closed (by user of via SetShouldClose).
Return value of this callback says, whether the window really should be closed.
If false
is returned, window remains opened.
Q: My app is refreshed only when I move my mouse type something, so my constantly changing Widgets doesn't work
A: Giu implements Power Saving Mode. UI is not re-rendered if no event happens. To baypass
this, you need to call giu.Update()
whenever you want to redraw UI.
Q: What is a Window?
A: Window is a place where widgets are actually rendered.
Windows are placed inside of MasterWindow.
Q: What are the types of Windows?
A: Dear ImGui has 3 types of windows:
- Window - couldb be moved around workspace. You can have as many Windows as you wish.
- Popup - is a special kind of window. It appears only when some specified action happens (e.g. Tooltip)
- Popup Modal - when this window appears, everything else becomes grayed as long as it is open. (e.g. Yes/No dialog)
GIU separates one more window type:
- Single Window - covers whole workspace. May be used as an alternative to many Windows in simple apps.
Q: How to use popups? I can't open them anyhow...
A: Generally poups are being refactored. Some useful information you can find in
this issue
Q: How to handle double-click event on any widget?
A: To do this, you simply need to use EventHandler
giu.Button("Double-click me"),
giu.Event().OnDClick(giu.MouseButtonLeft, func() {fmt.Println("I was double clicked!")}),
If you find anything you'd like to talk about in reference to this wiki, Don't hesitate to hit dedicated Discussion