@@ -68,20 +68,22 @@ func (c *Context) currentContainer() *container {
6868}
6969
7070func (c * Context ) Window (title string , rect image.Rectangle , f func (layout ContainerLayout )) {
71+ pc := caller ()
72+ id := c .idFromCaller (pc )
7173 c .wrapError (func () error {
72- if err := c .window (title , rect , 0 , f ); err != nil {
74+ if err := c .window (title , rect , 0 , id , f ); err != nil {
7375 return err
7476 }
7577 return nil
7678 })
7779}
7880
79- func (c * Context ) window (title string , bounds image.Rectangle , opt option , f func (layout ContainerLayout )) ( err error ) {
80- id := c . idFromGlobalString ( title )
81- c .idScopeFromGlobalString ( title , func () {
81+ func (c * Context ) window (title string , bounds image.Rectangle , opt option , id controlID , f func (layout ContainerLayout )) error {
82+ var err error
83+ c .idScopeFromID ( id , func () {
8284 err = c .doWindow (title , bounds , opt , id , f )
8385 })
84- return
86+ return err
8587}
8688
8789func (c * Context ) doWindow (title string , bounds image.Rectangle , opt option , id controlID , f func (layout ContainerLayout )) (err error ) {
@@ -263,9 +265,10 @@ func (c *Context) ClosePopup(name string) {
263265}
264266
265267func (c * Context ) Popup (name string , f func (layout ContainerLayout )) {
268+ id := c .idFromGlobalString (name )
266269 c .wrapError (func () error {
267270 opt := optionPopup | optionAutoSize | optionNoResize | optionNoScroll | optionNoTitle | optionClosed
268- if err := c .window (name , image.Rectangle {}, opt , f ); err != nil {
271+ if err := c .window (name , image.Rectangle {}, opt , id , f ); err != nil {
269272 return err
270273 }
271274 return nil
0 commit comments