Skip to content

Commit

Permalink
It's useful to return the dialog
Browse files Browse the repository at this point in the history
Then the caller can issue callbacks against the correct dialog widget
that are invoked when the dialog is closed.
  • Loading branch information
gcla committed Jul 19, 2020
1 parent e006962 commit da4ad3b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ui/dialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func (w *copyable) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid
return w.wrapper.UserInput(ev, size, focus, app)
}

func OpenMessage(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) {
openMessage(msgt, openOver, false, app)
func OpenMessage(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) *dialog.Widget {
return openMessage(msgt, openOver, false, app)
}

func OpenMessageForCopy(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) {
openMessage(msgt, openOver, true, app)
func OpenMessageForCopy(msgt string, openOver gowid.ISettableComposite, app gowid.IApp) *dialog.Widget {
return openMessage(msgt, openOver, true, app)
}

func openMessage(msgt string, openOver gowid.ISettableComposite, focusOnWidget bool, app gowid.IApp) {
func openMessage(msgt string, openOver gowid.ISettableComposite, focusOnWidget bool, app gowid.IApp) *dialog.Widget {
var al gowid.IHAlignment = hmiddle
if strings.Count(msgt, "\n") > 0 {
al = gowid.HAlignLeft{}
Expand Down Expand Up @@ -111,6 +111,8 @@ func openMessage(msgt string, openOver gowid.ISettableComposite, focusOnWidget b
wrapper: wrapper,
}, openOver, fixed, fixed, app,
)

return YesNo
}

func OpenTemplatedDialog(container gowid.ISettableComposite, tmplName string, app gowid.IApp) {
Expand Down

0 comments on commit da4ad3b

Please sign in to comment.