summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redo/containers_windows.go1
-rw-r--r--redo/controls_windows.go32
-rw-r--r--redo/zz_test.go4
3 files changed, 37 insertions, 0 deletions
diff --git a/redo/containers_windows.go b/redo/containers_windows.go
index d963b98..6398257 100644
--- a/redo/containers_windows.go
+++ b/redo/containers_windows.go
@@ -15,6 +15,7 @@ On Windows, container controls are just regular controls; their children have to
TODO
- make sure all tabs cannot be deselected (that is, make sure the current tab can never have index -1)
- make sure tabs initially show the right control
+- for some reason the text entry tabs show the checkbox tab until the checkbox tab is clicked, THEN they show their proper contents
*/
type tab struct {
diff --git a/redo/controls_windows.go b/redo/controls_windows.go
index 68ea05b..3d9da3e 100644
--- a/redo/controls_windows.go
+++ b/redo/controls_windows.go
@@ -125,3 +125,35 @@ func checkboxToggled(data unsafe.Pointer) {
c.clicked.fire()
println("checkbox toggled")
}
+
+type textField struct {
+ *widgetbase
+}
+
+var editclass = toUTF16("EDIT")
+
+func startNewTextField(style C.DWORD) *textField {
+ w := newWidget(editclass,
+ style | C.ES_LEFT | C.ES_NOHIDESEL | C.WS_BORDER | C.WS_TABSTOP,
+ C.WS_EX_CLIENTEDGE)
+ C.controlSetControlFont(w.hwnd)
+ return &textField{
+ widgetbase: w,
+ }
+}
+
+func newTextField() *textField {
+ return startNewTextField(0)
+}
+
+func newPasswordField() *textField {
+ return startNewTextField(C.ES_PASSWORD)
+}
+
+func (t *textField) Text() string {
+ return t.text()
+}
+
+func (t *textField) SetText(text string) {
+ t.settext(text)
+}
diff --git a/redo/zz_test.go b/redo/zz_test.go
index e7a48e7..e137494 100644
--- a/redo/zz_test.go
+++ b/redo/zz_test.go
@@ -48,6 +48,10 @@ func init() {
w.SetTitle(fmt.Sprint(c.Checked()))
})
t.Append("Checkbox", c)
+ e := NewTextField()
+ t.Append("Text Field", e)
+ e = NewPasswordField()
+ t.Append("Password Field", e)
w.Show()
})
<-done