readdy to attempt to change CreateButton()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
9177817db1
commit
30fc964c5e
|
@ -5,12 +5,34 @@ import "log"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
var subdomain *ui.Entry
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
// var subdomain *ui.Entry
|
||||||
|
|
||||||
|
func AddEntry(box *GuiBox, name string) *GuiEntry {
|
||||||
|
var ge *GuiEntry
|
||||||
|
ge = new(GuiEntry)
|
||||||
|
|
||||||
|
ue := ui.NewEntry()
|
||||||
|
ue.SetReadOnly(false)
|
||||||
|
ue.OnChanged(func(*ui.Entry) {
|
||||||
|
log.Println("gui.AddEntry() OK. ue.Text() =", ue.Text())
|
||||||
|
})
|
||||||
|
box.UiBox.Append(ue, false)
|
||||||
|
|
||||||
|
ge.E = ue
|
||||||
|
|
||||||
|
return ge
|
||||||
|
}
|
||||||
|
|
||||||
func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
||||||
|
var gb *GuiBox
|
||||||
|
gb = new(GuiBox)
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
wm.Box1 = vbox
|
wm.Box1 = vbox
|
||||||
|
gb.UiBox = vbox
|
||||||
|
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
@ -21,12 +43,7 @@ func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
||||||
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
||||||
hbox.Append(generate, false)
|
hbox.Append(generate, false)
|
||||||
|
|
||||||
subdomain = ui.NewEntry()
|
AddEntry(gb, "SUBDOMAIN")
|
||||||
subdomain.SetReadOnly(false)
|
|
||||||
subdomain.OnChanged(func(*ui.Entry) {
|
|
||||||
log.Println("OK. subdomain =", subdomain.Text())
|
|
||||||
})
|
|
||||||
vbox.Append(subdomain, false)
|
|
||||||
|
|
||||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||||
|
|
||||||
|
@ -38,14 +55,27 @@ func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
||||||
|
|
||||||
func generateSubdomain(b *GuiButton) {
|
func generateSubdomain(b *GuiButton) {
|
||||||
log.Println("generateSubdomain START")
|
log.Println("generateSubdomain START")
|
||||||
subdomain.SetText("cust00013.wit.dev")
|
if (b == nil) {
|
||||||
|
log.Println("generateSubdomain ERROR b == nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (b.Box == nil) {
|
||||||
|
log.Println("generateSubdomain ERROR b.Box == nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (b.Box.EntryMap == nil) {
|
||||||
|
log.Println("generateSubdomain ERROR b.Box.EntryMap == nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
spew.Dump(b.Box.EntryMap)
|
||||||
|
// subdomain.SetText("cust00013.wit.dev")
|
||||||
log.Println("generateSubdomain END")
|
log.Println("generateSubdomain END")
|
||||||
}
|
}
|
||||||
|
|
||||||
func addSubdomain(b *GuiButton) {
|
func addSubdomain(b *GuiButton) {
|
||||||
log.Println("generateSubdomain START")
|
log.Println("generateSubdomain START")
|
||||||
sub := subdomain.Text()
|
// sub := subdomain.Text()
|
||||||
log.Println("generateSubdomain subdomain =", sub)
|
// log.Println("generateSubdomain subdomain =", sub)
|
||||||
log.Println("generateSubdomain END")
|
log.Println("generateSubdomain END")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
structs.go
15
structs.go
|
@ -66,6 +66,7 @@ type GuiButton struct {
|
||||||
W *ui.Window
|
W *ui.Window
|
||||||
T *ui.Tab
|
T *ui.Tab
|
||||||
|
|
||||||
|
Box *GuiBox
|
||||||
AH *GuiArea
|
AH *GuiArea
|
||||||
|
|
||||||
// git.wit.com/wit/gui stuff
|
// git.wit.com/wit/gui stuff
|
||||||
|
@ -78,6 +79,14 @@ type GuiButton struct {
|
||||||
custom func (*GuiButton)
|
custom func (*GuiButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GuiBox struct {
|
||||||
|
W *GuiWindow
|
||||||
|
EntryMap map[string][]*GuiEntry
|
||||||
|
A *GuiArea
|
||||||
|
|
||||||
|
UiBox *ui.Box
|
||||||
|
}
|
||||||
|
|
||||||
type GuiEntry struct {
|
type GuiEntry struct {
|
||||||
E *ui.Entry
|
E *ui.Entry
|
||||||
Edit bool
|
Edit bool
|
||||||
|
@ -96,12 +105,6 @@ type GuiEntry struct {
|
||||||
Action string // what type of button
|
Action string // what type of button
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuiBox struct {
|
|
||||||
W *GuiWindow
|
|
||||||
EntryMap map[string][]*GuiEntry
|
|
||||||
A *GuiArea
|
|
||||||
}
|
|
||||||
|
|
||||||
type GuiWindow struct {
|
type GuiWindow struct {
|
||||||
W *ui.Window
|
W *ui.Window
|
||||||
T *ui.Tab
|
T *ui.Tab
|
||||||
|
|
Loading…
Reference in New Issue