diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-30 09:57:44 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-30 09:57:44 -0400 |
| commit | 33155f7496a818a1ed83fe49cccb63be7842bc81 (patch) | |
| tree | bbb14af3d92becf7d5ca5abfb28630a2b413ad93 /lineedit.go | |
| parent | e032807546a96e6489d18a0e42ced51b7c31a55c (diff) | |
Reverted everything back to the old API.
Diffstat (limited to 'lineedit.go')
| -rw-r--r-- | lineedit.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lineedit.go b/lineedit.go index 56ac97c..a45a443 100644 --- a/lineedit.go +++ b/lineedit.go @@ -2,8 +2,13 @@ package ui +import ( + "sync" +) + // A LineEdit is a control which allows you to enter a single line of text. type LineEdit struct { + lock sync.Mutex created bool sysData *sysData initText string @@ -28,6 +33,9 @@ func NewPasswordEdit() *LineEdit { // SetText sets the LineEdit's text. func (l *LineEdit) SetText(text string) { + l.lock.Lock() + defer l.lock.Unlock() + if l.created { l.sysData.setText(text) return @@ -37,6 +45,9 @@ func (l *LineEdit) SetText(text string) { // Text returns the LineEdit's text. func (l *LineEdit) Text() string { + l.lock.Lock() + defer l.lock.Unlock() + if l.created { return l.sysData.text() } @@ -44,6 +55,9 @@ func (l *LineEdit) Text() string { } func (l *LineEdit) make(window *sysData) error { + l.lock.Lock() + defer l.lock.Unlock() + l.sysData.alternate = l.password err := l.sysData.make(window) if err != nil { |
