diff --git a/listbox.go b/listbox.go index 7b1a399..8245a7b 100644 --- a/listbox.go +++ b/listbox.go @@ -146,8 +146,6 @@ func (l *Listbox) make(window *sysData) (err error) { for _, s := range l.initItems { l.sysData.append(s) } - // some platforms automatically select an item; undo that - l.sysData.selectIndices(nil) l.created = true return nil } diff --git a/listbox_darwin.go b/listbox_darwin.go index 05eeaa9..aa83d5d 100644 --- a/listbox_darwin.go +++ b/listbox_darwin.go @@ -217,12 +217,3 @@ func listboxDelete(listbox C.id, index int) { func listboxLen(listbox C.id) int { return int(C.listboxLen(listboxInScrollView(listbox))) } - -func listboxSelectIndices(id C.id, indices []int) { - listbox := listboxInScrollView(id) - if len(indices) == 0 { - C.listboxDeselectAll(listbox) - return - } - panic("selectListboxIndices() > 0 not yet implemented (TODO)") -} diff --git a/listbox_darwin.m b/listbox_darwin.m index cce97a0..25bd83e 100644 --- a/listbox_darwin.m +++ b/listbox_darwin.m @@ -37,6 +37,10 @@ id makeListboxArray(void) ac = [NSArrayController new]; [ac setAutomaticallyRearrangesObjects:NO]; + // we don't want Cocoa to change the selection when items are inserted + // found via TODO_get_Stack_Overflow_link; not sure how I missed it the first time + [ac setSelectsInsertedObjects:NO]; + // TODO figure out how to inhibit this behavior on delete return ac; } @@ -136,8 +140,3 @@ intptr_t listboxLen(id listbox) { return fromNSInteger([toNSTableView(listbox) numberOfRows]); } - -void listboxDeselectAll(id listbox) -{ - [toNSTableView(listbox) deselectAll:listbox]; -} diff --git a/objc_darwin.h b/objc_darwin.h index 09106f2..9bff48f 100644 --- a/objc_darwin.h +++ b/objc_darwin.h @@ -79,7 +79,6 @@ extern uintptr_t listboxIndexesCount(id); extern uintptr_t listboxIndexesFirst(id); extern uintptr_t listboxIndexesNext(id, uintptr_t); extern intptr_t listboxLen(id); -extern void listboxDeselectAll(id); /* prefsize_darwin.m */ extern struct xsize controlPrefSize(id); diff --git a/sysdata.go b/sysdata.go index 176a42d..d2ac699 100644 --- a/sysdata.go +++ b/sysdata.go @@ -41,7 +41,6 @@ var _xSysData interface { len() int setAreaSize(int, int) selectIndex(int) - selectIndices([]int) } = &sysData{} // this line will error if there's an inconsistency // signal sends the event signal. This raise is done asynchronously to avoid deadlocking the UI task. diff --git a/sysdata_darwin.go b/sysdata_darwin.go index 8da134a..720ce9c 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -33,7 +33,6 @@ type classData struct { delete func(id C.id, index int) len func(id C.id) int selectIndex func(id C.id, index int, alternate bool) - selectIndices func(id C.id, indices []int) } func addControl(parentWindow C.id, control C.id) { @@ -183,7 +182,6 @@ var classTypes = [nctypes]*classData{ selTexts: listboxSelectedTexts, delete: listboxDelete, len: listboxLen, - selectIndices: listboxSelectIndices, }, c_progressbar: &classData{ make: func(parentWindow C.id, alternate bool, s *sysData) C.id { @@ -419,13 +417,3 @@ func (s *sysData) selectIndex(index int) { } <-ret } - -func (s *sysData) selectIndices(indices []int) { - ret := make(chan struct{}) - defer close(ret) - uitask <- func() { - classTypes[s.ctype].selectIndices(s.id, indices) - ret <- struct{}{} - } - <-ret -} diff --git a/sysdata_unix.go b/sysdata_unix.go index e1b5ced..a1b9858 100644 --- a/sysdata_unix.go +++ b/sysdata_unix.go @@ -364,7 +364,3 @@ func (s *sysData) setAreaSize(width int, height int) { func (s *sysData) selectIndex(index int) { // TODO not yet implemented on Unix (added for Mac only right now) } - -func (s *sysData) selectIndices(indices []int) { - // TODO not yet implemented on Windows (added for Mac only right now) -} diff --git a/sysdata_windows.go b/sysdata_windows.go index bba0015..5bda9c0 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -646,7 +646,3 @@ func (s *sysData) setAreaSize(width int, height int) { func (s *sysData) selectIndex(index int) { // TODO not yet implemented on Windows (added for Mac only right now) } - -func (s *sysData) selectIndices(indices []int) { - // TODO not yet implemented on Windows (added for Mac only right now) -}