From 4045d50f946431408896a7b1512397c905e4bdb5 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 29 May 2014 04:41:07 -0400 Subject: [PATCH] Checked to see if the previous commit worked after removing the leftover Combobox selectIndex() code; it does. Removed the dummy code from the Windows and GTK+ backends as well. --- combobox.go | 2 -- combobox_darwin.m | 2 +- objc_darwin.h | 1 - sysdata.go | 1 - sysdata_darwin.go | 14 -------------- sysdata_darwin.m | 5 ----- sysdata_unix.go | 4 ---- sysdata_windows.go | 4 ---- todo.md | 2 -- 9 files changed, 1 insertion(+), 34 deletions(-) diff --git a/combobox.go b/combobox.go index 5060a45..86e38e9 100644 --- a/combobox.go +++ b/combobox.go @@ -143,8 +143,6 @@ func (c *Combobox) make(window *sysData) (err error) { for _, s := range c.initItems { c.sysData.append(s) } - // some platforms automatically select an item; undo that - c.sysData.selectIndex(-1) c.created = true return nil } diff --git a/combobox_darwin.m b/combobox_darwin.m index 5c88b07..b84b948 100644 --- a/combobox_darwin.m +++ b/combobox_darwin.m @@ -54,7 +54,7 @@ id makeCombobox(BOOL editable) #define BIND bind:comboboxBinding toObject:ac withKeyPath:comboboxKeyPath options:nil // for NSPopUpButton, we need a little extra work to make it respect the NSArrayController's selection behavior properties // thanks to stevesliva (http://stackoverflow.com/questions/23715275/cocoa-how-do-i-suppress-nspopupbutton-automatic-selection-synchronization-nsar) -// TODO where in the docs does it say that NSArrayController has a keyPath of selectionIndex? it's not in the Cocoa Bindings Reference +// note: selectionIndex isn't listed in the Cocoa Bindings Reference for NSArrayController under exposed bindings, but is in the Cocoa Bindings Programming Topics under key-value observant properties, so we can still bind to it #define BINDSEL bind:@"selectedIndex" toObject:ac withKeyPath:@"selectionIndex" options:nil if (!editable) { diff --git a/objc_darwin.h b/objc_darwin.h index dca3faa..e26db6f 100644 --- a/objc_darwin.h +++ b/objc_darwin.h @@ -103,7 +103,6 @@ extern void buttonSetTargetAction(id, id); extern void buttonSetText(id, id); extern id buttonText(id); extern id makeCheckbox(void); -extern void comboboxSelectIndex(id, BOOL, intptr_t); extern id makeLineEdit(BOOL); extern void lineeditSetText(id, id); extern id lineeditText(id); diff --git a/sysdata.go b/sysdata.go index d2ac699..1507912 100644 --- a/sysdata.go +++ b/sysdata.go @@ -40,7 +40,6 @@ var _xSysData interface { setProgress(int) len() int setAreaSize(int, int) - selectIndex(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 cb9f30b..72a5519 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -31,7 +31,6 @@ type classData struct { selTexts func(id C.id) []string delete func(id C.id, index int) len func(id C.id) int - selectIndex func(id C.id, index int, alternate bool) } func addControl(parentWindow C.id, control C.id) { @@ -135,9 +134,6 @@ var classTypes = [nctypes]*classData{ len: func(id C.id) int { return int(C.comboboxLen(id)) }, - selectIndex: func(id C.id, index int, alternate bool) { - C.comboboxSelectIndex(id, toBOOL(alternate), C.intptr_t(index)) - }, }, c_lineedit: &classData{ make: func(parentWindow C.id, alternate bool, s *sysData) C.id { @@ -406,13 +402,3 @@ func (s *sysData) setAreaSize(width int, height int) { } <-ret } - -func (s *sysData) selectIndex(index int) { - ret := make(chan struct{}) - defer close(ret) - uitask <- func() { - classTypes[s.ctype].selectIndex(s.id, index, s.alternate) - ret <- struct{}{} - } - <-ret -} diff --git a/sysdata_darwin.m b/sysdata_darwin.m index e4ad6f6..c04ce37 100644 --- a/sysdata_darwin.m +++ b/sysdata_darwin.m @@ -139,11 +139,6 @@ id makeCheckbox(void) return checkbox; } -void comboboxSelectIndex(id combobox, BOOL editable, intptr_t index) -{ - // TODO remove -} - id makeLineEdit(BOOL password) { if (password) diff --git a/sysdata_unix.go b/sysdata_unix.go index 2ba5059..77e334e 100644 --- a/sysdata_unix.go +++ b/sysdata_unix.go @@ -362,7 +362,3 @@ func (s *sysData) setAreaSize(width int, height int) { } <-ret } - -func (s *sysData) selectIndex(index int) { - // TODO not yet implemented on Unix (added for Mac only right now) -} diff --git a/sysdata_windows.go b/sysdata_windows.go index 99fc436..b9df277 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -643,7 +643,3 @@ func (s *sysData) setAreaSize(width int, height int) { } <-ret } - -func (s *sysData) selectIndex(index int) { - // TODO not yet implemented on Windows (added for Mac only right now) -} diff --git a/todo.md b/todo.md index 1691936..bb354ec 100644 --- a/todo.md +++ b/todo.md @@ -1,8 +1,6 @@ important things: - NSComboBox scans the entered text to see if it matches one of the items and returns the index of that item if it does; find out how to suppress this so that it returns -1 unless the item was chosen from the list (like the other platforms) - asked: http://stackoverflow.com/questions/23046414/cocoa-how-do-i-get-nscombobox-indexofselecteditem-to-return-1-if-the-user-m -- Mac OS X forces items selected when changing the NSPopUpButton (noneditable Combobox) lists; figure out how to inhibit this - - asked: http://stackoverflow.com/questions/23715275/cocoa-how-do-i-suppress-nspopupbutton-automatic-selection-synchronization-nsar super ultra important things: - 10.6 also spits a bunch of NSNoAutoreleasePool() debug log messages even though I thoguht I had everything in an NSAutoreleasePool...