basic start of a stubbed out 'textbox' entry box
This commit is contained in:
parent
7e47ca9843
commit
c2f8cac4a9
23
dropdown.go
23
dropdown.go
|
@ -23,6 +23,7 @@ import (
|
||||||
// screen debugging output I might be able to figure it
|
// screen debugging output I might be able to figure it
|
||||||
// it out now. maybe. notsure.
|
// it out now. maybe. notsure.
|
||||||
|
|
||||||
|
/*
|
||||||
func makeDropdownView(ddItems string) *guiWidget {
|
func makeDropdownView(ddItems string) *guiWidget {
|
||||||
newNode := addDropdown()
|
newNode := addDropdown()
|
||||||
tk := newNode.TK.(*guiWidget)
|
tk := newNode.TK.(*guiWidget)
|
||||||
|
@ -47,6 +48,7 @@ func makeDropdownView(ddItems string) *guiWidget {
|
||||||
tk.Show()
|
tk.Show()
|
||||||
return tk
|
return tk
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func addDropdownTK(wId int) *guiWidget {
|
func addDropdownTK(wId int) *guiWidget {
|
||||||
n := addDropdownNew(wId)
|
n := addDropdownNew(wId)
|
||||||
|
@ -99,7 +101,7 @@ func (tk *guiWidget) showDropdown() {
|
||||||
log.Log(GOCUI, "new dropdown items should be set to:", me.dropdown.items)
|
log.Log(GOCUI, "new dropdown items should be set to:", me.dropdown.items)
|
||||||
|
|
||||||
if me.dropdown.tk == nil {
|
if me.dropdown.tk == nil {
|
||||||
me.dropdown.tk = addDropdownTK(-77)
|
me.dropdown.tk = addDropdownTK(me.dropdown.wId)
|
||||||
}
|
}
|
||||||
if me.dropdown.tk == nil {
|
if me.dropdown.tk == nil {
|
||||||
log.Log(GOCUI, "showDropdown() IS BROKEN")
|
log.Log(GOCUI, "showDropdown() IS BROKEN")
|
||||||
|
@ -159,3 +161,22 @@ func dropdownUnclicked(w, h int) {
|
||||||
}
|
}
|
||||||
// log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
|
// log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tk *guiWidget) showTextbox() {
|
||||||
|
// todo: fix this after switching to protobuf
|
||||||
|
|
||||||
|
if me.textbox.tk == nil {
|
||||||
|
me.textbox.tk = addDropdownTK(me.textbox.wId)
|
||||||
|
}
|
||||||
|
if me.textbox.tk == nil {
|
||||||
|
log.Log(GOCUI, "showDropdown() IS BROKEN")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
startW, startH := tk.Position()
|
||||||
|
log.Log(GOCUI, "showDropdown() SHOWING AT W,H=", startW, startH)
|
||||||
|
me.textbox.tk.MoveToOffset(startW+3, startH+2)
|
||||||
|
me.textbox.tk.labelN = "holy cow"
|
||||||
|
me.textbox.tk.Show()
|
||||||
|
me.textbox.active = true
|
||||||
|
me.textbox.callerTK = tk
|
||||||
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
tk.showDropdown()
|
tk.showDropdown()
|
||||||
case widget.Dropdown:
|
case widget.Dropdown:
|
||||||
tk.showDropdown()
|
tk.showDropdown()
|
||||||
|
case widget.Textbox:
|
||||||
|
tk.showTextbox()
|
||||||
case widget.Flag:
|
case widget.Flag:
|
||||||
tk.dropdownClicked(w, h)
|
tk.dropdownClicked(w, h)
|
||||||
default:
|
default:
|
||||||
|
@ -104,7 +106,7 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sends the mouse click to a widget underneath
|
// sends the mouse click to a widget underneath
|
||||||
func click(g *gocui.Gui, v *gocui.View) error {
|
func clickOLD(g *gocui.Gui, v *gocui.View) error {
|
||||||
mouseW, mouseH := me.baseGui.MousePosition()
|
mouseW, mouseH := me.baseGui.MousePosition()
|
||||||
|
|
||||||
w := mouseW
|
w := mouseW
|
||||||
|
|
4
init.go
4
init.go
|
@ -44,6 +44,10 @@ func init() {
|
||||||
me.stdout.lastW = 30
|
me.stdout.lastW = 30
|
||||||
me.stdout.lastH = 10
|
me.stdout.lastH = 10
|
||||||
|
|
||||||
|
// just make up unique values for these
|
||||||
|
me.dropdown.wId = -77
|
||||||
|
me.textbox.wId = -55
|
||||||
|
|
||||||
// Set(&me, "dense")
|
// Set(&me, "dense")
|
||||||
|
|
||||||
me.myTree = tree.New()
|
me.myTree = tree.New()
|
||||||
|
|
|
@ -35,7 +35,6 @@ type config struct {
|
||||||
currentWindow *guiWidget // this is the current tab or window to show
|
currentWindow *guiWidget // this is the current tab or window to show
|
||||||
helpLabel *gocui.View // ?
|
helpLabel *gocui.View // ?
|
||||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||||
// dropdownW *guiWidget // grab the dropdown choices from this widget
|
|
||||||
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
FramePadW int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||||
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
FramePadH int `default:"1" dense:"0"` // When the widget has a frame, like a button, it adds 2 lines runes on each side
|
||||||
PadW int `default:"1" dense:"0"` // pad spacing
|
PadW int `default:"1" dense:"0"` // pad spacing
|
||||||
|
@ -67,6 +66,7 @@ type config struct {
|
||||||
stdout stdout // information for the STDOUT window
|
stdout stdout // information for the STDOUT window
|
||||||
showDebug bool // todo: move this into config struct
|
showDebug bool // todo: move this into config struct
|
||||||
dropdown dropdown // the dropdown menu
|
dropdown dropdown // the dropdown menu
|
||||||
|
textbox dropdown // the textbox popup window
|
||||||
allwin []*guiWidget // for tracking which window is next
|
allwin []*guiWidget // for tracking which window is next
|
||||||
downW int // where the mouse was pressed down
|
downW int // where the mouse was pressed down
|
||||||
downH int // where the mouse was pressed down
|
downH int // where the mouse was pressed down
|
||||||
|
@ -100,6 +100,7 @@ type dropdown struct {
|
||||||
h int // the height
|
h int // the height
|
||||||
active bool // is the dropdown menu currently in use?
|
active bool // is the dropdown menu currently in use?
|
||||||
init bool // moves the window offscreen on startup
|
init bool // moves the window offscreen on startup
|
||||||
|
wId int // the widget id to use
|
||||||
// dtoggle bool // is a dropdown or combobox currently active?
|
// dtoggle bool // is a dropdown or combobox currently active?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue