inkyblackness / imgui-go

Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Popup modal doesn't work

AllenDang opened this issue · comments

Popup doesn't show after I click the button.

        if imgui.Button("Click Me") {
		imgui.OpenPopup("Confirm")

		if imgui.BeginPopupModalV("Confirm", nil, imgui.WindowFlagsAlwaysAutoResize) {

			imgui.Text("Confirm to quit?")
			imgui.Separator()

			if imgui.Button("Yes") {
				imgui.CloseCurrentPopup()
			}
			imgui.SameLine()
			if imgui.Button("No") {
				imgui.CloseCurrentPopup()
			}

			imgui.EndPopup()
		}
	}

I see, it's not an issue, because I put the BeginPopupModal in the wrong place. I should move it out of the button click section and everything works fine.