package npc import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/widget" ) type FieldCreator struct { Representation *fyne.Container NameValue *widget.Entry DescValue *widget.Entry RegExValue *widget.Entry SizeLabel *widget.Label SizeValue *widget.Entry SizeInBits bool // to be filled with needed things } func CreateFieldCreator() *FieldCreator { fc := &FieldCreator{} fc.Representation = container.New(layout.NewFormLayout()) fc.Representation.Add(widget.NewLabel("")) fc.Representation.Add(widget.NewLabel("Field Values")) fc.Representation.Add(widget.NewLabel("Name")) fc.NameValue = widget.NewEntry() fc.Representation.Add(fc.NameValue) fc.Representation.Add(widget.NewLabel("Description")) fc.DescValue = widget.NewEntry() fc.DescValue.MultiLine = true fc.DescValue.SetMinRowsVisible(3) fc.Representation.Add(fc.DescValue) fc.Representation.Add(widget.NewLabel("RegEx")) fc.RegExValue = widget.NewEntry() fc.Representation.Add(fc.RegExValue) fc.SizeLabel = widget.NewLabel("Bytes") toggleBtn := widget.NewButton("T", func() { if fc.SizeInBits { fc.SizeLabel.SetText("Bytes") } else { fc.SizeLabel.SetText("Bits") } fc.SizeInBits = !fc.SizeInBits }) fc.Representation.Add(container.NewHBox(toggleBtn, fc.SizeLabel)) fc.SizeValue = widget.NewEntry() fc.Representation.Add(fc.SizeValue) return fc }