From e24ab04826499ecc15039cad5eaf746733d9f79d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 14 Dec 2017 19:30:39 +0100 Subject: [PATCH 1/4] declarative/listbox :: adds CurrentIndex field to ListBox struct and a setter to factory method. This enables the selection of an item at instantiation --- declarative/listbox.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/declarative/listbox.go b/declarative/listbox.go index cb51daf2..e85b3bef 100644 --- a/declarative/listbox.go +++ b/declarative/listbox.go @@ -53,6 +53,7 @@ type ListBox struct { AssignTo **walk.ListBox DataMember string Format string + CurrentIndex int Model interface{} MultiSelection bool OnCurrentIndexChanged walk.EventHandler @@ -80,6 +81,7 @@ func (lb ListBox) Create(builder *Builder) error { return builder.InitWidget(lb, w, func() error { w.SetFormat(lb.Format) w.SetPrecision(lb.Precision) + w.SetCurrentIndex(lb.CurrentIndex) if err := w.SetDataMember(lb.DataMember); err != nil { return err From b0b8664b418e72e18c107027373ee6754affe1ca Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 14 Dec 2017 19:48:10 +0100 Subject: [PATCH 2/4] declarative/listbox :: streamlined indentation --- declarative/listbox.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/declarative/listbox.go b/declarative/listbox.go index e85b3bef..2821b33c 100644 --- a/declarative/listbox.go +++ b/declarative/listbox.go @@ -53,7 +53,7 @@ type ListBox struct { AssignTo **walk.ListBox DataMember string Format string - CurrentIndex int + CurrentIndex int Model interface{} MultiSelection bool OnCurrentIndexChanged walk.EventHandler From ebe21ae3a66d225bd798dbd2f8583fec13137bf2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 14 Dec 2017 20:05:00 +0100 Subject: [PATCH 3/4] declarative/listbox :: adds myself to AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 4da81936..16c0c117 100644 --- a/AUTHORS +++ b/AUTHORS @@ -27,3 +27,4 @@ Semyon Tokarev Shawn Sun Tim Dufrane Vincent Vanackere +Lorenz Rosenthal \ No newline at end of file From 0894d5d2f2bb347dc26b74840c59e99191746e11 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 14 Dec 2017 20:06:45 +0100 Subject: [PATCH 4/4] declarative/listbox :: adds a newline at end of AUTHORS --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 16c0c117..62317fe0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -27,4 +27,4 @@ Semyon Tokarev Shawn Sun Tim Dufrane Vincent Vanackere -Lorenz Rosenthal \ No newline at end of file +Lorenz Rosenthal