Duplicate controls appearing in popup modal in latest version of cimgui-go wrapper. #7405

Closed
opened 2024-03-14 17:19:45 +00:00 by damntourists · 0 comments
damntourists commented 2024-03-14 17:19:45 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

v1.90.4

Back-ends:

custom backend https://github.com/damntourists/cimgui-go-ebiten

Compiler, OS:

ubuntu

Full config/build information:

No response

Details:

My Issue/Question:
Hi Omar!

I've been debugging a strange issue with modal popups and I'm not sure if this has something to do with the cimgui, or cimgui-go wrappers at https://github.com/cimgui/cimgui && https://github.com/AllenDang/cimgui-go that may be causing it and was curious if you've seen anything like this in the imgui project?

My issue is that all controls defined inside of a popup are being duplicated. I'm using a custom backend for cimgui-go at https://github.com/damntourists/cimgui-go-ebiten which is still heavily a work in progress, but I can't seem to track down where this issue is coming from within the wrappers/backend. Curious if this could be an imgui thing? Perhaps the cimgui project needs to rebuild with the latest commits of imgui? I see the commit we're using of imgui is ocornut/imgui@c6aa051629.

Any insight you may have would be greatly appreciated.

Screenshots/Video:

modal_contents_duplication

Minimal, Complete and Verifiable Example code:

func MakeProjectManagerWindow() {
	modalFlags := imgui.WindowFlagsNone |
		imgui.WindowFlagsNoResize |
		imgui.WindowFlagsAlwaysAutoResize

	var inputName string

	imgui.BeginV(ProjectManagerWindow.FullTitle(), &ProjectManagerWindow.open,
		ProjectManagerWindow.flags.combined())

	imgui.OpenPopupStr(pm.AddSceneModalTitle) // force it open for now to debug issue

	if imgui.BeginPopupModalV(pm.AddSceneModalTitle, nil, imgui.WindowFlags(modalFlags)) {
		imgui.SetKeyboardFocusHere()

		imgui.Text("hello")

		if imgui.InputTextWithHint("##AddSceneNameInput", "Name", &inputName,
			imgui.InputTextFlagsEnterReturnsTrue, nil) {
			scene_orm.CreateScene(inputName, pm.CurrentProject.ID(), pm.CurrentProject.ID())
			pm.CurrentProject.FetchScenes()
			imgui.CloseCurrentPopup()
		}

		//imgui.ShowDemoWindow()
		imgui.InternalDebugDrawCursorPos()
		imgui.InternalDebugDrawItemRect()
		imgui.InternalDebugLocateItemResolveWithLastItem()
		imgui.EndPopup()
	}

	imgui.BeginChildIDV(imgui.IDStr("projectmanger-view"),
		imgui.ContentRegionAvail(), imgui.ChildFlagsBorder,
		imgui.WindowFlagsNone)

	//ExpandSelection(projectmanger.CurrentProject.ID())

	imgui.EndChild()

	if imgui.BeginPopupContextItemV("pm-context", imgui.MouseButtonRight) {
		if imgui.SelectableBool("add scene") {
			imgui.OpenPopupStr(pm.AddSceneModalTitle)
		}
		if imgui.SelectableBool("add entity") {
			// add entity
		}
		imgui.EndPopup()
	}
	imgui.End()
}
### Version/Branch of Dear ImGui: v1.90.4 ### Back-ends: custom backend https://github.com/damntourists/cimgui-go-ebiten ### Compiler, OS: ubuntu ### Full config/build information: _No response_ ### Details: **My Issue/Question:** Hi Omar! I've been debugging a strange issue with modal popups and I'm not sure if this has something to do with the cimgui, or cimgui-go wrappers at https://github.com/cimgui/cimgui && https://github.com/AllenDang/cimgui-go that may be causing it and was curious if you've seen anything like this in the imgui project? My issue is that all controls defined inside of a popup are being duplicated. I'm using a custom backend for cimgui-go at https://github.com/damntourists/cimgui-go-ebiten which is still heavily a work in progress, but I can't seem to track down where this issue is coming from within the wrappers/backend. Curious if this could be an imgui thing? Perhaps the cimgui project needs to rebuild with the latest commits of imgui? I see the commit we're using of imgui is https://github.com/ocornut/imgui/tree/c6aa051629753f0ef0d26bf775a8b6a92aa213b2. Any insight you may have would be greatly appreciated. ### Screenshots/Video: ![modal_contents_duplication](https://github.com/ocornut/imgui/assets/1501643/78f64810-cb64-44e6-ba25-ff33512e9389) ### Minimal, Complete and Verifiable Example code: ```golang func MakeProjectManagerWindow() { modalFlags := imgui.WindowFlagsNone | imgui.WindowFlagsNoResize | imgui.WindowFlagsAlwaysAutoResize var inputName string imgui.BeginV(ProjectManagerWindow.FullTitle(), &ProjectManagerWindow.open, ProjectManagerWindow.flags.combined()) imgui.OpenPopupStr(pm.AddSceneModalTitle) // force it open for now to debug issue if imgui.BeginPopupModalV(pm.AddSceneModalTitle, nil, imgui.WindowFlags(modalFlags)) { imgui.SetKeyboardFocusHere() imgui.Text("hello") if imgui.InputTextWithHint("##AddSceneNameInput", "Name", &inputName, imgui.InputTextFlagsEnterReturnsTrue, nil) { scene_orm.CreateScene(inputName, pm.CurrentProject.ID(), pm.CurrentProject.ID()) pm.CurrentProject.FetchScenes() imgui.CloseCurrentPopup() } //imgui.ShowDemoWindow() imgui.InternalDebugDrawCursorPos() imgui.InternalDebugDrawItemRect() imgui.InternalDebugLocateItemResolveWithLastItem() imgui.EndPopup() } imgui.BeginChildIDV(imgui.IDStr("projectmanger-view"), imgui.ContentRegionAvail(), imgui.ChildFlagsBorder, imgui.WindowFlagsNone) //ExpandSelection(projectmanger.CurrentProject.ID()) imgui.EndChild() if imgui.BeginPopupContextItemV("pm-context", imgui.MouseButtonRight) { if imgui.SelectableBool("add scene") { imgui.OpenPopupStr(pm.AddSceneModalTitle) } if imgui.SelectableBool("add entity") { // add entity } imgui.EndPopup() } imgui.End() } ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#7405
No description provided.