Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Make NSMatrix of unresponsive NSTextFieldCells

Make NSMatrix of unresponsive NSTextFieldCells
Thread Tools
DayLateDon
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Oct 15, 2001, 10:31 PM
 
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
     
Dalgo
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Oct 17, 2001, 08:20 AM
 
>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.
     
lindberg
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Oct 19, 2001, 03:50 PM
 
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.
     
DayLateDon  (op)
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Oct 19, 2001, 11:51 PM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:46 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,