0.3.1 Started working on dialogs. /JL

This commit is contained in:
2022-12-20 07:42:40 +01:00
parent 757fa04105
commit f7e0c48bdb
3 changed files with 35 additions and 1 deletions

26
dialog.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
"log"
"github.com/lxn/walk"
)
func (mw *MyMainWindow) openImage() error {
dlg := new(walk.FileDialog)
dlg.FilePath = UserPath
dlg.Filter = "Image Files (*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff"
dlg.Title = "选择图片"
if ok, err := dlg.ShowOpen(mw.MainWindow); err != nil {
return err
} else if !ok {
return nil
}
prevFilePath := dlg.FilePath
log.Println("prevFilePath:", prevFilePath)
return nil
}

View File

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

View File

@@ -163,6 +163,10 @@ func CreateCanvasProperties(mw *MyMainWindow) {
grcolb, _ := walk.NewPushButton(grcom)
cb.SetAlignment(walk.AlignHFarVNear)
grcolb.SetText("Grid color")
grcolb.Clicked().Attach(func() {
log.Println("Grid color button clicked")
mw.openImage()
})
log.Println("Grid color button created")
log.Println("Creating pixels checkbox")
cb, _ = walk.NewCheckBox(mw.properties.propCanvas.property)
@@ -187,6 +191,10 @@ func CreateCanvasProperties(mw *MyMainWindow) {
grcolb, _ = walk.NewPushButton(mw.properties.propCanvas.property)
grcolb.SetAlignment(walk.AlignHFarVNear)
grcolb.SetText("Background color")
grcolb.Clicked().Attach(func() {
log.Println("Background color button clicked")
mw.openImage()
})
log.Println("Background color button created")
bg, _ := walk.NewSolidColorBrush(walk.RGB(255, 255, 255))
mw.properties.propCanvas.property.SetBackground(bg)