File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -674,6 +674,12 @@ func (c *Context) OpenPopup(name string) {
674674 c .bringToFront (cnt )
675675}
676676
677+ func (c * Context ) ClosePopup (name string ) {
678+ id := c .idFromGlobalUniqueString (name )
679+ cnt := c .container (id , 0 )
680+ cnt .open = false
681+ }
682+
677683func (c * Context ) Popup (name string , f func (layout ContainerLayout )) {
678684 opt := optionPopup | optionAutoSize | optionNoResize | optionNoScroll | optionNoTitle | optionClosed
679685 c .window (name , image.Rectangle {}, opt , f )
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ func (g *Game) testWindow(ctx *debugui.Context) {
5454 ctx .Popup ("Test Popup" , func (layout debugui.ContainerLayout ) {
5555 ctx .Button ("Hello" )
5656 ctx .Button ("World" )
57+ if ctx .Button ("Close" ) {
58+ ctx .ClosePopup ("Test Popup" )
59+ }
5760 })
5861 })
5962
You can’t perform that action at this time.
0 commit comments