diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-20 01:08:24 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-20 01:08:24 -0400 |
| commit | 5f830deec8374336d1d268a27e41f5ec492c866c (patch) | |
| tree | a1df8752d48e692aead5ab9162856efe64cb4dfd /redo/basicctrls.go | |
| parent | d07230e55e6c1b001cd09e03816710e66a34e7f4 (diff) | |
Added events and validity methods to TextField and implemented the events on the GTK+ backend.
Diffstat (limited to 'redo/basicctrls.go')
| -rw-r--r-- | redo/basicctrls.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/redo/basicctrls.go b/redo/basicctrls.go index 8894e7c..cee60f2 100644 --- a/redo/basicctrls.go +++ b/redo/basicctrls.go @@ -48,6 +48,15 @@ type TextField interface { // Text and SetText are Requests that get and set the TextField's text. Text() string SetText(text string) + + // OnChanged is triggered when the text in a TextField is changed somehow. + // Do not bother trying to figure out how the text was changed; instead, perform your validation and use Invalid to inform the user that the entered text is invalid instead. + OnChanged(func()) + + // Invalid throws a non-modal alert (whose nature is system-defined) on or near the TextField that alerts the user that input is invalid. + // The string passed to Invalid will be displayed to the user to inform them of what specifically is wrong with the input. + // Pass an empty string to remove the warning. + Invalid(reason string) } // NewTextField creates a new TextField. |
