highlihgts: - remember to open popup in the same level it is defined - IsOpen should generally be only getter (changing respective variable's value will not cause popup open/close) - there is a bypass code below: https://github.com/AllenDang/giu/issues/565#issuecomment-1279962476 tl;dr: --- Hi there! I'm trying to make a PopupModal widget and... (again) I met an issue cpde: ```golang package main import "github.com/AllenDang/giu" type settings struct { id string } func newSettings() *settings { return &settings{ id: "settings", } } func (s *settings) Open() { giu.OpenPopup(s.id) } func (s *settings) Build() { giu.PopupModal(s.id).Layout( giu.Button("close").OnClick(giu.CloseCurrentPopup), ).Build() } var settingsInstance *settings = newSettings() func loop() { giu.MainMenuBar().Layout( giu.Menu("File").Layout( settingsInstance, giu.MenuItem("settings").OnClick(settingsInstance.Open), ), ).Build() } func main() { wnd := giu.NewMasterWindow("popups!", 640, 480, 0) wnd.Run(loop) } ``` what is wrong?
Activity
gucio321 commentedon Oct 16, 2022
okey, while working on constitutor I finally found it:
THE
giu.OpenPopup(...)NEEDS TO BE CALLED IN THE SAME LAYOUT LEVEL AS POPUP DEFINITION(I think it was already said somewhere but I didn't understand it 😄)
here is my wrapper for PopupModal:
you just call popup.Open() to open it
@AllenDang can I add it to giu?
gucio321 commentedon Oct 16, 2022
and one more thing: popupModals cannot be definied inside MenuWidget, why?
gucio321 commentedon Oct 16, 2022
ok, another imporvement - I baypassed imgui at all ;-)
[-]POPUPS! they don't work![/-][+]Popups workaround[/+]gucio321 commentedon Jul 10, 2024
will be added on wiki in FAQ