GOOD: add Node.SetMargined()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
20899fc2b4
commit
50a33262c1
|
@ -1,6 +1,6 @@
|
||||||
package gui
|
package gui
|
||||||
|
|
||||||
// import "log"
|
import "log"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
@ -71,3 +71,40 @@ func (n *Node) MakeBasicControlsPage(title string) *Node {
|
||||||
newNode.uiBox = vbox
|
newNode.uiBox = vbox
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Node) MakeGroupEdit(title string) *Node {
|
||||||
|
n.Dump()
|
||||||
|
|
||||||
|
group := ui.NewGroup(title)
|
||||||
|
group.SetMargined(true)
|
||||||
|
n.uiBox.Append(group, true)
|
||||||
|
|
||||||
|
entrybox := ui.NewNonWrappingMultilineEntry()
|
||||||
|
|
||||||
|
group.SetChild(entrybox)
|
||||||
|
|
||||||
|
log.Println("entrybox =", entrybox)
|
||||||
|
n.uiMultilineEntry = entrybox
|
||||||
|
newNode := n.AddNode(title)
|
||||||
|
newNode.uiMultilineEntry = entrybox
|
||||||
|
newNode.uiGroup = group
|
||||||
|
return newNode
|
||||||
|
|
||||||
|
/*
|
||||||
|
panic("dump")
|
||||||
|
entryForm := ui.NewForm()
|
||||||
|
entryForm.SetPadded(true)
|
||||||
|
group.SetChild(entryForm)
|
||||||
|
|
||||||
|
entryForm.Append("Entry", ui.NewEntry(), false)
|
||||||
|
entryForm.Append("Password Entry", ui.NewPasswordEntry(), false)
|
||||||
|
entryForm.Append("Search Entry", ui.NewSearchEntry(), false)
|
||||||
|
entryForm.Append("Multiline Entry", ui.NewMultilineEntry(), true)
|
||||||
|
entryForm.Append("Multiline Entry No Wrap", ui.NewNonWrappingMultilineEntry(), true)
|
||||||
|
|
||||||
|
origbox.Append(vbox, false)
|
||||||
|
newNode := n.AddNode(title)
|
||||||
|
newNode.uiBox = vbox
|
||||||
|
*/
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
16
entry.go
16
entry.go
|
@ -1,6 +1,7 @@
|
||||||
package gui
|
package gui
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
import "errors"
|
||||||
// import "fmt"
|
// import "fmt"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
|
@ -29,7 +30,20 @@ func (n *Node) SetText(value string) error {
|
||||||
n.uiButton.SetText(value)
|
n.uiButton.SetText(value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
if (n.uiMultilineEntry != nil) {
|
||||||
|
n.uiMultilineEntry.SetText(value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
n.Dump()
|
||||||
|
return errors.New("couldn't find something to set the text to")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *Node) SetMargined(x bool) {
|
||||||
|
if (n.uiGroup != nil) {
|
||||||
|
n.uiGroup.SetMargined(x)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Println("Couldn't find something that has a Margin setting")
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultEntryChange(e *ui.Entry) {
|
func defaultEntryChange(e *ui.Entry) {
|
||||||
|
|
|
@ -65,6 +65,8 @@ type Node struct {
|
||||||
uiBox *ui.Box
|
uiBox *ui.Box
|
||||||
uiArea *ui.Area
|
uiArea *ui.Area
|
||||||
uiText *ui.EditableCombobox
|
uiText *ui.EditableCombobox
|
||||||
|
uiMultilineEntry *ui.MultilineEntry
|
||||||
|
uiGroup *ui.Group
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Parent() *Node {
|
func (n *Node) Parent() *Node {
|
||||||
|
|
Loading…
Reference in New Issue