diff --git a/gui.go b/gui.go index 0b52ec5..36d297e 100644 --- a/gui.go +++ b/gui.go @@ -134,6 +134,14 @@ func mouseClick(b *ButtonMap) { createAddVmBox(Data.cloudTab, "Create New Virtual Machine") return } + if (b.Action == "SHOW VM") { + Data.CurrentVM = b.VM + if (Data.Debug) { + go ui.Main(ShowVM) + } else { + createVmBox(Data.cloudTab, b.VM) + } + } if (b.Action == "ADD") { log.Println("\tgui.mouseClick() SHOULD ADD VM HERE?") } @@ -194,7 +202,6 @@ func CreateButton(a *pb.Account, vm *pb.Event_VM, newmap.VM = vm newmap.Action = action newmap.custom = custom -// newmap.aTab = Data.CurrentTab Data.AllButtons = append(Data.AllButtons, newmap) return newB diff --git a/structs.go b/structs.go index 1420989..903034d 100644 --- a/structs.go +++ b/structs.go @@ -65,8 +65,9 @@ type GuiDataStructure struct { // This is "GLOBAL" AllButtons []ButtonMap - // a tab (maybe the one the user is playing with?) // a VM (maybe the one the user is playing with?) + // if opening a new window, this is a trick to + // pass it in CurrentVM *pb.Event_VM // All the tabs @@ -162,6 +163,8 @@ type HumanCellData struct { TextID int Color color.RGBA ColorID int + VM *pb.Event_VM + Button *ButtonMap } type HumanMap struct { diff --git a/tableCallbacks.go b/tableCallbacks.go index 1f926d4..6b9d2eb 100644 --- a/tableCallbacks.go +++ b/tableCallbacks.go @@ -97,18 +97,15 @@ func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.Ta func defaultSetCellValue(mh *TableData, row int, column int) { if (mh.Cells[column].Name == "BUTTON") { humanID := mh.Cells[column].HumanID - vmname := mh.Rows[row].HumanData[humanID].Text - log.Println("vmname =", vmname) - log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column) - // Data.CurrentVM = fmt.Sprintf("%s",vmname) - Data.CurrentVM = mh.Rows[row].VM - log.Println("User last clicked on Data.CurrentVM =", mh.Rows[row].VM) + log.Println("defaultSetCellValue() FOUND THE TABLE BUTTON ", row, humanID) + + button := mh.Rows[row].HumanData[humanID].Button + if (button != nil) { + mouseClick(button) + return + } if (Data.Debug) { - go ui.Main(ShowVM) - } else { - // AddVmConfigureTab(vmname, mh.Rows[row].PbVM) - // createVmBox(Data.cloudTab, buttonVmClick, mh.Rows[row].PbVM) - createVmBox(Data.cloudTab, mh.Rows[row].VM) + panic("defaultSetCellValue() GOT AN UNKNOWN BUTTON CLICK IN TABLE") } } }