|
|
Make NSMatrix of unresponsive NSTextFieldCells
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2000
Status:
Offline
|
|
Hello ...
I'm trying to set up an NSMatrix of NSTextFieldCells that don't respond (darken or become boxed) when clicked; essentially, I want to create a simple grid of "message text"-type fields. (It's a "high score" list for a game.) Disabling the cells works as far as the unresponsiveness goal is concerned, but of course the displayed text gets discolored, which I don't want.
Also, I want to make one of the cells editable (for a player to enter a name). That's easy enough to do, but I can't seem to get the cell to call its target to log the change "on end editing", as with a regular text field. If editing ends without a return/enter, the target isn't called at all; if return/enter is pressed, the _NSMatrix_ hits the cell's target, even though the NSMatrix doesn't itself have a target set. (I guess that would be okay, if I had a way to retrieve the coordinates of the instigating cell.)
Suggestions?
Thanks and regards,
DayLateDon
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status:
Offline
|
|
>I'm trying to set up an NSMatrix of NSTextFieldCells that don't respond (darken or become boxed) when clicked
You can make NSTextFields with the editable flag set to NO and the enabled flag set to YES, but the NSTextFieldCell class doesn't appear to have an editable flag so set enabled to NO, then send it a setTextColor message and make the text black again.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
Cells have an editable flag; -setEditable: is declared in NSCell.h.
I think you should be able to call -selectedCell on the NSMatrix to
get the cell that the user edited. Or use -keyCell if that doesn't work.
NSMatrix will use the cell's target if it's set, otherwise use the
matrix' target (if it's set). But the "sender" is the matrix, since
that's the view that you're modifying. Cells are utility classes to
be used by views; NSTextField is a simple view wrapper around
NSTextFieldCell.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2000
Status:
Offline
|
|
Hello ...
Thanks for the responses.
Just setting a text cell of an NSMatrix to uneditable doesn't do what I want. Sure, I can't type into it, but the cell still reacts (darkens or boxes --not the "focus ring" box, just a black outline) to clicks. I want the matrix to be completely dead space, click-wise, except for one "live" cell.
I've gotten frustrated enough with the NSMatrix that I reverted back to a grid of NSTextFields. Less elegant, but it works.
Thanks again, and regards,
DayLateDon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|