table mouse clicks are now almost all handled the same way

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 14:48:46 -07:00
parent 2a00db1c6b
commit ce7788d613
2 changed files with 15 additions and 2 deletions

View File

@ -123,6 +123,15 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData) {
mh.Rows[row].HumanData[5].Color = defaultTextBlack
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",item.Name)
// create 'fake' button entries for the mouse clicks within tables
var newButtonMap gui.ButtonMap
newButtonMap.Action = "SHOW VM"
newButtonMap.VM = item // set the button to this VM
newButtonMap.Account = data.Account
gui.Data.AllButtons = append(gui.Data.AllButtons, newButtonMap)
mh.Rows[row].HumanData[6].Button = &newButtonMap
mh.Rows[row].HumanData[6].VM = item
mh.Rows[row].VM = item
log.Println("\titem=", item)

View File

@ -163,8 +163,10 @@ func mainMouseClick(b *gui.ButtonMap) {
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
}
log.Println("mainMouseClick() b.Action =", b.Action)
log.Println("mainMouseClick() b.Action =", b.Account)
spew.Dump(b.Account)
gui.Data.Current = b.Account
// gui.Data.Current = b.Account
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE")
if (b.Account != nil) {
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
@ -191,6 +193,7 @@ func mainMouseClick(b *gui.ButtonMap) {
log.Println("\tFINISHED FULL STACK DUMP")
} else if (b.Action == "ADD") {
log.Println("\tSHOULD ADD ACCOUNT HERE")
/*
if (gui.Data.CurrentTab != nil) {
if (gui.Data.CurrentTab.EntryNick != nil) {
nick := gui.Data.CurrentTab.EntryNick.Text()
@ -208,6 +211,7 @@ func mainMouseClick(b *gui.ButtonMap) {
config.Accounts = append(config.Accounts, acc)
}
}
*/
} else if (b.Action == "LOGIN") {
log.Println("\tTRIGGER LOGIN ACCOUNT")
gui.Data.State = "SEND LOGIN"