finally can phase out misc.go
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2af6fa52a4
commit
7e81dd00e0
42
entry.go
42
entry.go
|
@ -101,3 +101,45 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
|
||||||
|
|
||||||
return ge
|
return ge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func defaultEntryChange(e *ui.Entry) {
|
||||||
|
for key, em := range Data.AllEntries {
|
||||||
|
if (Data.Debug) {
|
||||||
|
log.Println("\tdefaultEntryChange() Data.AllEntries =", key, em)
|
||||||
|
}
|
||||||
|
if Data.AllEntries[key].UiEntry == e {
|
||||||
|
log.Println("defaultEntryChange() FOUND",
|
||||||
|
"action =", Data.AllEntries[key].Action,
|
||||||
|
"Last =", Data.AllEntries[key].Last,
|
||||||
|
"e.Text() =", e.Text())
|
||||||
|
Data.AllEntries[key].Last = e.Text()
|
||||||
|
if Data.AllEntries[key].Normalize != nil {
|
||||||
|
fixed := Data.AllEntries[key].Normalize(e.Text())
|
||||||
|
e.SetText(fixed)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Println("defaultEntryChange() ERROR. MISSING ENTRY MAP. e.Text() =", e.Text())
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultMakeEntry(startValue string, edit bool, action string) *GuiEntry {
|
||||||
|
e := ui.NewEntry()
|
||||||
|
e.SetText(startValue)
|
||||||
|
if (edit == false) {
|
||||||
|
e.SetReadOnly(true)
|
||||||
|
}
|
||||||
|
e.OnChanged(defaultEntryChange)
|
||||||
|
|
||||||
|
// add the entry field to the global map
|
||||||
|
var newEntry GuiEntry
|
||||||
|
newEntry.UiEntry = e
|
||||||
|
newEntry.Edit = edit
|
||||||
|
newEntry.Action = action
|
||||||
|
if (action == "Memory") {
|
||||||
|
newEntry.Normalize = normalizeInt
|
||||||
|
}
|
||||||
|
Data.AllEntries = append(Data.AllEntries, &newEntry)
|
||||||
|
|
||||||
|
return &newEntry
|
||||||
|
}
|
||||||
|
|
|
@ -128,6 +128,7 @@ func normalizeInt(s string) string {
|
||||||
return clean
|
return clean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func defaultEntryChange(e *ui.Entry) {
|
func defaultEntryChange(e *ui.Entry) {
|
||||||
for key, em := range Data.AllEntries {
|
for key, em := range Data.AllEntries {
|
||||||
if (Data.Debug) {
|
if (Data.Debug) {
|
||||||
|
@ -169,6 +170,7 @@ func defaultMakeEntry(startValue string, edit bool, action string) *GuiEntry {
|
||||||
|
|
||||||
return &newEntry
|
return &newEntry
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||||
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
Loading…
Reference in New Issue