From ce7788d613c055d7332422ed9ea7dc1387e04746 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 26 May 2019 14:48:46 -0700 Subject: [PATCH] table mouse clicks are now almost all handled the same way Signed-off-by: Jeff Carr --- eventChannel.go | 11 ++++++++++- main.go | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/eventChannel.go b/eventChannel.go index 673c4e5..99475be 100644 --- a/eventChannel.go +++ b/eventChannel.go @@ -123,7 +123,16 @@ 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) - mh.Rows[row].VM = item + // 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) log.Println("\titem.Name=", item.Name) diff --git a/main.go b/main.go index 95dcb43..ab57b32 100644 --- a/main.go +++ b/main.go @@ -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"