Glad to meet you, the DSClickableURLTextField class has been excellent :) I didn't subclass it, I just made my own little modifications to it here and there. Here is the minSizeForContent method:
- (NSSize)minSizeForContent { // Grab the height for the text float newHeight = [[self attributedStringValue] heightForWidth:[self frame].size.width]; // Add 10 more pixels onto the size for safety and make new NSSize NSSize newSize = NSMakeSize([self frame].size.width, newHeight + 10.0); return newSize; } The -heightForWidth: method and several other geometrics related methods are being used from a category which can be found here: http://www.sheepsystems.com/sourceCode/sourceStringGeometrics.html The category creates its own NSTextContainer, NSTextStorage, NSLayoutManager, etc. I'm sure it would be more efficient if I used the existing layout manager in DSClickableURLTextField, haven't gotten to that yet. That might be a good feature to add in future versions, a method that performs functions similarly to what is in the category. Other modifications I made (I don't exactly remember), but I changed some things to allow for selection of the text. The issue with this is that now when you click on a link the link text returns to that default blue underline style (haven't found a way around this yet). And sure, I would love to test out the new version :-) Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-23, at 6:56 PM, Michael Nickerson wrote: > > On Dec 23, 2009, at 2:08 PM, PCWiz wrote: > >> It all seems to be stable now, so turning off background layout worked :-) >> >> Thanks >> > > > Hey, I know you worked out what is going on, just thought I'd write you > directly here. I'm the creator of the DSClickableURLTextField class. Did > you subclass it and add in your own stuff for -minSizeForContent? Not that > there's anything wrong with that at all (I enjoy seeing the class used!), > just thought that I'd chime in and say that you don't really need to create > another layout manager for this class. It already creates and uses one for > tracking where the URL is when you click it, so you could just use it > directly to calculate sizes. > > And, I actually have an updated version. I'll be posting it to my website > sometime soonish, but if you'd like I can send you a copy now. New & updated > stuff with this version: > > * Fixes a bug where what the layout manager uses and what the text field > shows could be slightly out of sync, > * Fixes a bug where centering the text would entirely mess up where it > thought the URLs were for clicking, > * Now uses -setObjectValue: directly, so it should work with bindings with no > extra work, > * Adds in tool tips, which show the entire URL (ON by default, but can be > turned off), > * Adds in dragging of the URL (ON by default, but can be turned off) > > Also, when you copy (or drag), it now adds the URL to the pasteboard, and > will go and find what the text displayed for the URL is and put that in the > string pasteboard. Most applications pick up on that and display the text > with the link being the URL, though some don't. At the moment there's no way > to turn this off - it's one of the things I keep meaning to add in. > > Let me know if you'd like it, and I'll send it on. > > -------------------------------------- > Darkshadow > (aka Michael Nickerson) > http://www.nightproductions.net > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com