Editing with attributes in NSTableView
Editing with attributes in NSTableView
- Subject: Editing with attributes in NSTableView
- From: Neville Smythe <email@hidden>
- Date: Tue, 3 Jul 2001 13:31:09 +1000
I'm working my way through Learning Cocoa and have hit a problem
with NSTableView; given my state of knowledge it's no doubt something
I'm neglecting to do but it looks a bit like a bug.
Modify the Expenses example to allow the user to add text attributes
to the fields in the TableView:
the fields become NSAttributedString, and in awakeFromNib set
setAllowsEditingTextAttributes:YES
for the dataCell of each of the 3 tableColumns in the NSTableView .
This works fine - user can change text, font, italics etc. BUT if the
user copies a field and pastes into another field, on exiting from
the editing mode the field is set to the empty string, and an
exception is raised in the Run panel of Project Builder:
Exception raised during posting of notification. Ignored.
exception: *** -[NSCFArray objectAtIndex:]: index (-1) beyond bounds
(3)
Some notification I need to implement? Well, maybe, but in fact
copy-and paste DOES work for just ONE column in my actual modified
app (which has in fact 4 columns, and I cannot see any difference in
the the way the columns are treated by my code).
ALSO: one more question if I may: I'd like the user to be able to
enter some mathematical stuff in one column - they can change to the
Symbolic keyboard and the Symbol font, which works - but how can I
programatically change to the Symbolic keyboard when this column is
selected for editing? I don't see anything about accessing the active
keyboard in the docs. Some unicode magic?
(further, and this surely is a MacOSX bug, the keyboard does not
automatically change to the Symbol keyboard when the user clicks in a
symbolic piece of text, even though the International keyboard
preference "Font and Keyboard synchronization" is checked)
--
$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?
Neville Smythe email@hidden
School of Mathematical Science Tel: 61-2-6125-2709
Australian National University Fax: 61-2-6125-4984
Canberra ACT 0200 AUSTRALIA *NB Changed* Mob: 0414517719