Skip to content
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

[bug] Cannot pass IsOpen changes the state of the window #927

Closed
ayayStay opened this issue Dec 12, 2024 · 3 comments
Closed

[bug] Cannot pass IsOpen changes the state of the window #927

ayayStay opened this issue Dec 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ayayStay
Copy link

ayayStay commented Dec 12, 2024

What happend?

I have called '. OpenPopup', but it cannot pass IsOpen to change its open state.
Is there any other way to close the Popup window except CloseCurrentPopup?

Code example

package main

import (
	"github.com/AllenDang/giu"
)

var (
	closeSign bool = false
)

func main() {
	wnd := giu.NewMasterWindow("Popup Example", 400, 300, 0)
	wnd.Run(loop)
}

func loop() {
	var pop *giu.PopupModalWidget
	pop = giu.PopupModal("modal").Layout(
		giu.Label("This is a modal popup."),
		giu.Button("Close").OnClick(func() {
			// giu.CloseCurrentPopup()
			pop.IsOpen(&closeSign)
			giu.Update()
		}),
	)
	giu.SingleWindow().Layout(
		giu.Button("Open Modal Popup").OnClick(func() {
			giu.OpenPopup("modal")
		}),
		pop,
	)
}

To Reproduce

  1. Run my demo
  2. will see the crash...

Version

master

OS

Windows 10,go 1.23.3,giu v0.11.0

@ayayStay ayayStay added the bug Something isn't working label Dec 12, 2024
@gucio321
Copy link
Collaborator

gucio321 commented Jan 8, 2025

@ayayStay sorry for late reply.
Popups mechanism is a bit tricky in giu (and imgui as well).
We have a wiki section about it... well... We will have in a second... FOr now the whole popups thing is hidden in FAQ section of our wiki and somewhere here in issues.
Gimma a second and I'll get back with a wiki link 😄

@gucio321
Copy link
Collaborator

gucio321 commented Jan 8, 2025

@gucio321
Copy link
Collaborator

gucio321 commented Jan 20, 2025

closing "due to age". lmk if you need further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants