Note that there are some explanatory texts on larger screens.

plurals
  1. POSubclassing a NSTextField
    text
    copied!<p>First off; I'm a COMPLETE newbie at Cocoa, so please bare with me for asking what I am sure is an inane and utter newbish question. </p> <p>My situation is as follows: I want to expand on the functionality of NSTextField. AMong the things I want to achieve is:</p> <p>Changing the look and feel of the caret.</p> <p>Detecting when the text reaches a certain number of characters and then coloring the text after that limit differently. *</p> <p>To my great frustration after spending quite some time googling I find hundreds of hits that simply state "Sublass NSTextField and use this code.", and to my humiliation I have found myself unable to grok exactly how to do this. </p> <p>I would be extremely grateful if someone could give me a working example of a subclass that achieves one of the two things I list above, and instructions* on how to implement the code so I can try and figure out how it works by looking at some actual live code.</p> <hr> <h3>I am extremely apologetic for my late response!</h3> <p>Apologies to all of you. I have a colic infant at home, and as you (or at least those of you that have children) can imagine this takes up quite a lot of your available time. Thank you all for your responses.</p> <p>I see that one of my main problems is that I don't have a sufficient understanding of delegates and outlets. I have purchased the book recommended here (and many other places. Some sort of "Bible" I gather) and I'm looking into it as we speak in the few silent hours I have these days. :) </p> <p>But although I can see it's going to be an indispensable tool for me I still gain the most understanding from studying examples rather than reading the theory* and so I would be extremely grateful if someone would create a project with a proper subclass of the relevant class since I understand that I should probably not be extending the NSTextfield class?</p> <p>I would instantly mark Mark Thalmans post as the answer as I'm sure it's a proper "for dummies" response, but I'll hold out for a few days since I'd really love a file to peruse. But I am not ungrateful! </p> <p>Oh, and; Please believe me guys when I say I'm not quite as useless in languages I actually know. It's just that these concepts with the Interface Builder and GUIs connection to the code is very unknown to me. I usually just write the code and keep it at that.</p> <hr> <p>*Yes, my first little training project is indeed a Twitter Utility.</p> <p>*Like to a child</p> <p>*Not that reading the theory hasn't got tremendous value for me as well. I wouldn't be where I am without Colin Moock definitive guide to AS3</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload