Skip to content

Commit 8646ebd

Browse files
committed
debugui: change TextBox to return bool
1 parent 9a1dcb8 commit 8646ebd

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

control.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ func (c *Context) numberTextBox(value *float64, id controlID) bool {
293293
return false
294294
}
295295

296-
func (c *Context) textBox(buf *string, opt option) Response {
296+
func (c *Context) textBox(buf *string, opt option) bool {
297297
id := c.idFromString(fmt.Sprintf("%p", buf))
298-
return c.textBoxRaw(buf, id, opt)
298+
return c.textBoxRaw(buf, id, opt)&ResponseSubmit != 0
299299
}
300300

301301
func formatNumber(v float64, digits int) string {

example/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (g *Game) logWindow(ctx *debugui.Context) {
162162
// input textbox + submit button
163163
var submitted bool
164164
ctx.SetGridLayout([]int{-1, 70}, nil)
165-
if ctx.TextBox(&g.logSubmitBuf)&debugui.ResponseSubmit != 0 {
165+
if ctx.TextBox(&g.logSubmitBuf) {
166166
ctx.SetFocus()
167167
submitted = true
168168
}

widget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func (c *Context) Button(label string) bool {
1212
return result
1313
}
1414

15-
func (c *Context) TextBox(buf *string) Response {
15+
func (c *Context) TextBox(buf *string) bool {
1616
return c.textBox(buf, 0)
1717
}
1818

0 commit comments

Comments
 (0)