0.0.16 Working on properties. /JL

This commit is contained in:
2022-12-12 20:29:09 +01:00
parent d37ec60248
commit 951fb373a7
2 changed files with 84 additions and 5 deletions
+7 -5
View File
@@ -11,9 +11,9 @@ import (
type MyMainWindow struct {
*walk.MainWindow
colors *walk.ScrollView
canvasscroll *walk.ScrollView
canvasScroll *walk.ScrollView
drawWidget *walk.CustomWidget
properties *walk.ScrollView
propScroll *walk.ScrollView
pallette Pallette
beads []*BeadColor
brand_combo *walk.ComboBox
@@ -22,11 +22,12 @@ type MyMainWindow struct {
serie_model []string
pegboard_combo *walk.ComboBox
pegboard_model []string
properties *properties
}
const (
AppName string = "BeadImager"
Version string = "0.0.15"
Version string = "0.0.16"
CopyRight string = "©2022 Jan Lerking"
STD_MESS string = "Ready"
UserPath string = "C:\\Users\\janle\\BeadImager"
@@ -43,6 +44,7 @@ func main() {
walk.ValidationErrorEffect, _ = walk.NewBorderGlowEffect(walk.RGB(255, 0, 0))
})
mw := &MyMainWindow{}
mw.properties = new(properties)
log.Println("MainWindow created")
CreatePallette(mw)
log.Println("Pallette created: ", mw.pallette)
@@ -165,7 +167,7 @@ func main() {
Layout: VBox{},
Children: []Widget{
ScrollView{
AssignTo: &mw.canvasscroll,
AssignTo: &mw.canvasScroll,
Layout: VBox{MarginsZero: true},
Children: []Widget{
CustomWidget{
@@ -184,7 +186,7 @@ func main() {
MaxSize: Size{220, 0},
Children: []Widget{
ScrollView{
AssignTo: &mw.properties,
AssignTo: &mw.propScroll,
Layout: VBox{MarginsZero: true},
},
},
+77
View File
@@ -0,0 +1,77 @@
package main
import (
"log"
"github.com/lxn/walk"
)
type (
properties struct {
propColor *PropColor
propScale *PropScale
propCanvas *PropCanvas
}
PropColor struct {
*walk.Composite
}
PropScale struct {
*walk.Composite
}
PropCanvas struct {
property *walk.Composite
}
)
func (cp *PropCanvas) newPropCanvas(mw *MyMainWindow) {
var err error
log.Println("Creating canvas properties...")
cp.property, err = walk.NewComposite(mw.propScroll)
if err != nil {
log.Println("Error creating canvas properties: ", err)
}
cp.property.SetAlignment(walk.AlignHNearVNear)
vb := walk.NewVBoxLayout()
vb.SetMargins(walk.Margins{5, 0, 20, 0})
cp.property.SetLayout(vb)
grcom, _ := walk.NewComposite(cp.property)
hb := walk.NewHBoxLayout()
hb.SetMargins(walk.Margins{5, 0, 20, 0})
grcom.SetLayout(hb)
log.Println("Creating grid checkbox")
cb, _ := walk.NewCheckBox(grcom)
cb.SetText("Show grid")
log.Println("Grid checkbox created")
walk.NewHSpacer(grcom)
log.Println("Creating grid color button")
grcolb, _ := walk.NewPushButton(grcom)
grcolb.SetText("Grid color")
log.Println("Grid color button created")
log.Println("Creating pixels checkbox")
cb, _ = walk.NewCheckBox(cp.property)
cb.SetText("Show pixels as beads")
log.Println("Pixels checkbox created")
log.Println("Creating canvas background color button")
grcolb, _ = walk.NewPushButton(cp.property)
grcolb.SetText("Grid color")
log.Println("Grid color button created")
}
func NewCanvasProperties() *properties {
return new(properties)
}
func newPropScale() *PropScale {
return new(PropScale)
}
func newPropColor() *PropColor {
return new(PropColor)
}
func newProperties() *properties {
return new(properties)
}