|
|
Editing Multiple Values in a Master/Detail Interface
|
|
|
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
I have a table bound to an NSArrayController. I have a window which allows editing of selected items in that table. In this window, there are textfields bound to the selection for each of the columns in the table. When multiple rows are selected in the table, I can enter text into the corresponding textfield and change the value for multiple selected rows. The classic master/detail interface.
Heres the rub. If the values are different in the rows, I have it set to display "Multiple Values Selected" as a placeholder. If I put my cursor in the textfield and the tab out or otherwise shift focus, all entries in the tableview bound to that textfield are clobbered to nil. I mean I havent typed anything. I simply clicked in the textfield or tabbed into it. I want it such that editing only occurs if I actually edit something. Im sure others must have run accross this issue and It must be something I havent set somewhere. How do you all get around this? Do I have to make my own field editor that doesnt send its action unless its stringValue has changed? That sounds great as I type it, but as far as actually implementing it, id be lost...
|
3R1C
|
|
|
|
|
|
|
|
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status:
Offline
|
|
I'm not entirely sure which method to override in a subclass (and, in fact, I'm not sure whether you'd have to subclass NSTextField or NSTextFieldCell), but the principle is the same: subclass in IB, create the files, override the method, save, and set the Custom Class for each of the text fields to your new subclass.
|
I bring order to chaos. You are in chaos windows, you are the contradiction, a bug wishing to be an OS.
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Oct 2001
Status:
Offline
|
|
You wouldn't subclass either. You'd have to subclass the Field Editor that the NSTextField cell uses. That much I know. How to implement that field editor is where Im lost.
|
3R1C
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|