summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/textbox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
committerJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
commit49202eeafdad8e5780fefdad3d2f87fd4354725e (patch)
tree5d749b5d4835c7a0395bd1f87b5d2d1d91b14a08 /toolkit/andlabs/textbox.go
parent80317ec89c94beadcbf3775f84c6010b5ceef302 (diff)
release as v0.6.5v0.6.5
good standard release really clean interaction to plugin really clean debug flags implementation common doAppend() idea, but it probably won't work re-implement combobox. this code base almost doesn't suck slider & spinner set values now tab set margin works convert dropdown to Send() lots of other changes to try to implement single line Entry() I guess use golang file names even though internalally the go developers use underscore chars in the actual go sources. Maybe there is a reason for that? go channel debug window does something make a debug window for channels. add sample icons Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/textbox.go')
-rw-r--r--toolkit/andlabs/textbox.go62
1 files changed, 56 insertions, 6 deletions
diff --git a/toolkit/andlabs/textbox.go b/toolkit/andlabs/textbox.go
index e916fd9..ddc27a4 100644
--- a/toolkit/andlabs/textbox.go
+++ b/toolkit/andlabs/textbox.go
@@ -1,9 +1,11 @@
package main
-import "git.wit.org/wit/gui/toolkit"
+import (
+ "git.wit.org/wit/gui/toolkit"
-import "github.com/andlabs/ui"
-import _ "github.com/andlabs/ui/winmanifest"
+ "github.com/andlabs/ui"
+ _ "github.com/andlabs/ui/winmanifest"
+)
func newTextbox(parentW *toolkit.Widget, w *toolkit.Widget) {
log(debugToolkit, "NewTexbox()", w.Name)
@@ -15,8 +17,9 @@ func newTextbox(parentW *toolkit.Widget, w *toolkit.Widget) {
log(debugError, "FFFFFFFFFFFF listMap()")
log(debugError, "FFFFFFFFFFFF listMap()")
}
+
// t.NewTextbox(w)
-// func (t andlabsT) NewTextbox(w *toolkit.Widget) *andlabsT {
+// func (t *andlabsT) NewTextbox(w *toolkit.Widget) *andlabsT {
var newt *andlabsT
newt = new(andlabsT)
@@ -37,6 +40,41 @@ func newTextbox(parentW *toolkit.Widget, w *toolkit.Widget) {
t.uiBox.Append(c, stretchy)
}
+ /*
+ // don't bother with "images" on andlabs/ui
+ "image"
+ "bytes"
+ _ "image/png"
+ "image/draw"
+
+ if (w.Name == "image") {
+ log(true, "NewTextbox() trying to add a new image")
+ i := ui.NewImage(16, 16)
+ img, _, err := image.Decode(bytes.NewReader(rawImage))
+ if err != nil {
+ panic(err)
+ }
+ nr, ok := img.(*image.RGBA)
+ if !ok {
+ i2 := image.NewRGBA(img.Bounds())
+ draw.Draw(i2, i2.Bounds(), img, img.Bounds().Min, draw.Src)
+ nr = i2
+ }
+ i.Append(nr)
+ t.uiBox.Append(i, true)
+
+ var img *ui.Image
+ var icon []byte
+ var imgA image.Image
+
+ icon, _ = res.ReadFile("resources/ping6.working.png")
+ // imgA, _, err := image.Decode(bytes.NewReader(b))
+ imgA, _, _ = image.Decode(icon)
+ img.Append(imgA)
+ img.Append(icon)
+ }
+ */
+
c.OnChanged(func(spin *ui.MultilineEntry) {
w.S = newt.uiMultilineEntry.Text()
// this is still dangerous
@@ -81,9 +119,21 @@ func (t *andlabsT) doSimpleAction() {
log(debugChange, "Going to attempt:", t.tw.Action)
switch t.tw.Action {
case "Enable":
- t.uiMultilineEntry.Enable()
+ if (t.uiEntry != nil) {
+ t.uiEntry.Enable()
+ } else if (t.uiMultilineEntry != nil) {
+ t.uiMultilineEntry.Enable()
+ } else {
+ log(true, "don't know what to enable", t.Name)
+ }
case "Disable":
- t.uiMultilineEntry.Disable()
+ if (t.uiEntry != nil) {
+ t.uiEntry.Disable()
+ } else if (t.uiMultilineEntry != nil) {
+ t.uiMultilineEntry.Disable()
+ } else {
+ log(true, "don't know what to disable", t.Name)
+ }
case "Show":
t.uiMultilineEntry.Show()
case "Hide":