0.3.4 Added dialog for adding beads. /JL

This commit is contained in:
2022-12-21 00:36:16 +01:00
parent 39f280e10e
commit 3fa09049eb
3 changed files with 37 additions and 1 deletions

View File

@@ -129,6 +129,17 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b
}
img, _ := walk.NewImageFromFileForDPI("images/plus_alpha.png", 96)
color.add.SetImage(img)
color.add.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
var data Serie
if button == walk.LeftButton {
for _, s := range color.Series {
if s.Name == mw.serie_combo.Text() {
data = *s
}
}
mw.addBeads(name, data, color.ColorID, color.backgroundColor)
}
})
color.info, err = walk.NewImageView(cm)
if err != nil {
log.Println("Error creating info image view: ", err)

View File

@@ -2,10 +2,35 @@ package main
import (
"log"
"strconv"
"github.com/lxn/walk"
)
func (mv *MyMainWindow) addBeads(name string, data Serie, id int, bg walk.Brush) error {
log.Println("Adding beads...")
dlg, err := walk.NewDialog(mv.MainWindow)
if err != nil {
return err
}
dlg.SetTitle("Add Beads")
dlg.SetLayout(walk.NewVBoxLayout())
dlg.SetSize(walk.Size{Width: 300, Height: 200})
dlg.SetMinMaxSize(walk.Size{Width: 300, Height: 200}, walk.Size{Width: 300, Height: 200})
dlg.SetX(mv.MainWindow.X() + 100)
dlg.SetY(mv.MainWindow.Y() + 100)
cmp, _ := walk.NewComposite(dlg)
cmp.SetLayout(walk.NewVBoxLayout())
cmp.Layout().SetMargins(walk.Margins{0, 0, 0, 0})
lbl, _ := walk.NewTextLabel(cmp)
lbl.SetText(name + " - " + strconv.Itoa(id))
lbl.SetAlignment(walk.AlignHCenterVCenter)
cmp.SetBackground(bg)
dlg.Show()
return nil
}
func (mw *MyMainWindow) openImage() error {
dlg := new(walk.FileDialog)

View File

@@ -30,7 +30,7 @@ type MyMainWindow struct {
const (
AppName string = "BeadImager"
Version string = "0.3.3"
Version string = "0.3.4"
CopyRight string = "©2022 Jan Lerking"
STD_MESS string = "Ready"
LogFile string = "BeadImager.log"