diff --git a/color.go b/color.go index efb54dc..97b623e 100644 --- a/color.go +++ b/color.go @@ -14,9 +14,11 @@ type ( backgroundColor walk.Brush InfoTooltip *walk.ToolTip WarningTooltip *walk.ToolTip + ErrorTooltip *walk.ToolTip add *walk.ImageView info *walk.ImageView warning *walk.ImageView + error *walk.ImageView Brand string Series []*Serie Weight []int @@ -47,12 +49,20 @@ func ShowBeads(mw *MyMainWindow, serie string) { bead.Color.SetVisible(true) bead.InfoTooltip.SetText(bead.info, "Approx. "+fmt.Sprint(s.onHand)+" left on hand") bead.WarningTooltip.SetText(bead.warning, "Only "+fmt.Sprint(s.onHand)+" left on hand") + bead.ErrorTooltip.SetText(bead.error, "Out of stock") if s.onHand <= 200 { bead.warning.SetVisible(true) bead.info.SetVisible(false) + bead.error.SetVisible(false) } else { bead.warning.SetVisible(false) bead.info.SetVisible(true) + bead.error.SetVisible(false) + } + if s.onHand <= 0 { + bead.warning.SetVisible(false) + bead.info.SetVisible(false) + bead.error.SetVisible(true) } } } @@ -200,6 +210,16 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b color.warning.SetImage(walk.IconWarning()) color.WarningTooltip.AddTool(color.warning) color.warning.SetVisible(false) + color.error, err = walk.NewImageView(cm) + if err != nil { + log.Println("Error creating error image view: ", err) + } + //Setup error tooltip + color.ErrorTooltip, _ = walk.NewToolTip() + color.ErrorTooltip.SetErrorTitle(name + " - " + fmt.Sprint(id)) + color.error.SetImage(walk.IconError()) + color.ErrorTooltip.AddTool(color.error) + color.error.SetVisible(false) lbl, _ := walk.NewLabel(cm) lbl.SetText(fmt.Sprint("Color ID: ", id)) diff --git a/main.go b/main.go index 10c6680..a2714c4 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,7 @@ type MyMainWindow struct { const ( AppName string = "BeadImager" - Version string = "0.4.1" + Version string = "0.4.2" CopyRight string = "©2022 Jan Lerking" STD_MESS string = "Ready" LogFile string = "BeadImager.log"