giu icon indicating copy to clipboard operation
giu copied to clipboard

Popup Window outside the Master Window

Open OfflinePing opened this issue 1 year ago • 1 comments

What happend?

I created a Master Window with a Popup Modal inside. And I am able to drag it anywhere on the screen. I dont know if this is intended or a bug :D

image

Code example

main.go
package main

import g "github.com/AllenDang/giu"

func loop() {
	Window := g.SingleWindow()

	Window.Layout(
		g.PopupModal("Popup Modal").Layout(
			g.Label("This is a popup modal"),
			g.Button("Close").OnClick(func() {
				g.CloseCurrentPopup()
			}),
		),
		g.Row(
			g.Button("Open Popup Modal").OnClick(func() {
				g.OpenPopup("Popup Modal")
			}),
		),
	)
}

func main() {
	wnd := g.NewMasterWindow("Cloud - Universal", 750, 500, g.MasterWindowFlagsNotResizable)

	wnd.Run(loop)
}

To Reproduce

  1. Run my demo
  2. Drag the Window around
  3. See its outside Master Window

Version

master

OS

Windows 11

OfflinePing avatar Aug 11 '24 14:08 OfflinePing

It is docking branch of imgui, idk how to disable it tbh. Ill need to check

gucio321 avatar Aug 11 '24 15:08 gucio321

@OfflinePing I've checked out and added it on wiki: https://github.com/AllenDang/giu/wiki/FAQ#windows

Q: I can drag my Window out of the MasterWindow! I don't want that!
A: This is a new Dear ImGui feature from the docking branch that is enabled by default in cimgui-go. To disable it, do the following after NewMasterWindow:

io := imgui.CurrentIO()
io.SetConfigFlags(io.ConfigFlags() & ^imgui.ConfigFlagsViewportsEnable)

gucio321 avatar Oct 13 '24 09:10 gucio321