0.3.1 Started working on dialogs. /JL
This commit is contained in:
26
dialog.go
Normal file
26
dialog.go
Normal 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
|
||||
}
|
2
main.go
2
main.go
@@ -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"
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user