From 1389fda5283165b7bfa123fcd595b0b0e53a8f28 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 9 Mar 2014 11:33:05 -0400 Subject: [PATCH] Made Listboxes non-editable in Mac OS X; also more TODOs. --- listbox_darwin.go | 4 ++++ todo.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/listbox_darwin.go b/listbox_darwin.go index 9575af6..251b256 100644 --- a/listbox_darwin.go +++ b/listbox_darwin.go @@ -150,6 +150,8 @@ func listboxArrayController(tableColumn C.id) C.id { Now with all that done, we're ready to creat a table column. Columns need string identifiers; we'll just reuse the item key. + +Editability is also handled here, as opposed to in NSTableView itself. */ var ( @@ -157,11 +159,13 @@ var ( _initWithIdentifier = sel_getUid("initWithIdentifier:") _tableColumnWithIdentifier = sel_getUid("tableColumnWithIdentifier:") + // _setEditable in sysdata_darwin.go ) func newListboxTableColumn() C.id { column := objc_alloc(_NSTableColumn) column = C.objc_msgSend_id(column, _initWithIdentifier, listboxItemKey) + C.objc_msgSend_bool(column, _setEditable, C.BOOL(C.NO)) // TODO other properties? bindListboxArray(column, newListboxArray()) return column diff --git a/todo.md b/todo.md index f03931e..192b313 100644 --- a/todo.md +++ b/todo.md @@ -27,11 +27,11 @@ so I don't forget: - Index(n) is the name used by reflect.Value; use a different one? important things: -- Cocoa Listboxes should not be editable - because the main event loop is not called if initialization fails, it is presently impossible for MsgBoxError() to work if UI initialization fails; this basically means we cannot allow initializiation to fail on Mac OS X if we want to be able to report UI init failures to the user with one - figure out where to auto-place windows in Cocoa (also window coordinates are still not flipped properly so (0,0) on screen is the bottom-left) - also provide a method to center windows; Cocoa provides one for us but - I think Cocoa NSButton text is not vertically aligned properly...? + - and listbox item text is too low? - NSPopUpButton does allow no initial selection ([b setSelectedIndex:-1]); use it - need to use it /after/ adding initial items, otherwise it won't work - find out if I can do the same with the ListBoxes