Archive for December, 2006

Bordering on addiction…

Soda Tower

Also starring the candy from my world famous commercial.

Mail Unread Menu 2.0.3

So, as a result of this thread in the forum, I realized that Mail Unread Menu doesn’t correctly install unless you’ve already installed bundles before and run the appropriate terminal commands. However, that should be fixed now. There was also another small update or two. You can get this special new version at the website.

Detecting URLs in a TextView

For a while now, I’ve wanted to add a feature to Assignment Planner that detects when you’ve typed a URL into any of the notes fields and displays the URL as a link. Coincidentally, while I was adding LRFilterBar and (the newly released) LRCalendarView to Cocoadev’s ObjectLibrary, I caught a glance of BlackHole Media’s URLTextView, which gets close to what I was looking for.

The problem is that the example will take text from an NSTextField and add it to the NSTextView, looking for URLs before it does so. But, I needed an editable NSTextView which will look for URLs as you type them in. So, I added the following code to the subclass:

- (void)didChangeText
  NSMutableAttributedString* inputValue = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@", [self string]]] autorelease];
  [inputValue detectURLs:[NSColor blueColor]];
  [[self textStorage] setAttributedString:inputValue];
  [super didChangeText];

- (void)setString:(NSString *)aString
  [super setString:aString];
  [self didChangeText];

So the didChangeText function is called whenever the text inside of the NSTextView changes. We take the text inside of the view, analyze it for URLs using the NSMutableAttributedString additions that come with the URLTextView and then replace the contents with our new attributed string.

We override the setString: function so that when we first set the string of the textbox, the contents are analyzed right off the bat. I found that without it, when an assignment was selected, the notes showed up but without all of the links. Then any one change in the box would create the links. So adding this function fixes the problem.

The only other issue that I had with the URLTextView was that the included finger pointer that should appear when the cursor hovers over the link doesn’t display. But, I don’t have a big problem with it, since it’s quite clear that the blue underlined link is clickable. Otherwise, this is the perfect solution to the problem.

URLTextView is available at BlackHole Media’s Code page.

LRFilterBar 1.4

Just a quick note to mention that the LRFilterBar has been updated a couple times in the past week or so. Kevin O. of CoolMacSoftware sent me some great additions to the code which were very easy to implement and are really beneficial to the functionality of the filter bar. He also suggested a better way to get the user’s OS version, which seems to work well.

LRFilterBar logo

I’ll also be posting some more stuff in the Code section, when I get the chance. The next item to be posted will be the LRCalendarView and the Code Generator will be afterwards.

Also, I’m going to be making more blog posts here, since people seem to make their way over here more than I thought. (I guess people like to hear a developer’s perspective every once in a while…) Next up, I’ll talk about Mint, which I just installed on Friday, and is the reason that I know people read the blog so much.

Some Updates…

Josh Llewellyn has posted a review of Assignment Planner and an interview with myself. The interview can be read over here.

I’ve finally added the Code section to the web site. The first item that I’ve uploaded was the LRFilterBar, some Cocoa open source code to create a Mail or iTunes like filter bar. Go over to the code page to take a look. I’ll be adding the LRCalendarView, the Registration Code Generator and some other fun treats soon.

Finally, I’ve moved the entire website over to a new server. The site’s now hosted by Surpass Hosting and everything has been going great so far. I plan on adding some Minty goodness in the near future, too.

:: RSS Feed :: Archive :: Categories :: Admin