This is old content! The graveyard is a snapshot of content created from 2002-2005. For new stuff, visit Maniacal Rage.
 

xPad Version 1.0

posted on december 17, 2003, tag: xpad

I have spent the last nine months working on my first OS X application. Countless hours, frustration, elation and work. I can't tell you how this feels. It feels like nothing I've ever felt before. I created something, from beginning to end, and now I get to share all of my hard work with you.

It is with great pride and immense pleasure that I announce the immediate availability of xPad Version 1.0.

Comments

There are 16 comments, comments are closed

Jacob Haas on 12/18/2003:

Love the new program, man. This is the kind of thing I've been looking for, but I like this better than all the other multi-document text programs out there. Good job!

Jonathan on 12/18/2003:

Thanks for all the hard work and dedication Garrett!

Tom Dolan on 12/18/2003:

It feels and seems great. I'm looking forward to putting it through it's paces over the next few days, but as a busy guy who runs a design shop, and who is forever looking for a note here and there (and who has tried and pretty much hates iCal, stickies, Omni Outliner), I'm looking forward to seeing out xPad might fit my needs. Thanks for the hard work.

Joshua on 12/18/2003:

Congratulations, Garrett!

Sharif on 12/18/2003:

Well done!

I'm actually sitting here, looking for things to organize so that I can see what it can really do.

Garrett on 12/18/2003:

Thanks everyone!

Sam on 12/18/2003:

Congrats! I don't have a Mac yet, but the screenshots look cool. Nothing available for Windows looks quite so cool, either... Anybody wanna donate a PowerBook to a starving college student? ;-)

dez on 12/19/2003:

xPad is nice. No more 20 sticky notes on my desktop! Also Garrett sorry for messing you around. Didn't know my email was wrong till you alerted me to it. No one has spent an hour trying to track me down before. Normally I wait three days and then have to chase my license and till now haven't realised why. Thanks and nice job. (BTW confirmation should be in your inbox)

Garrett on 12/20/2003:

dez: Glad I could help. Your license is on its way.

Jon Gales on 12/22/2003:

Love it. Would like a tie in to WebCore to preview HTML docs though :P. I'm always wading through HTML.

Garrett on 12/22/2003:

Jon—I considered adding that feature back when WebKit was released, but I decided against it because we thought it might be adding things to a texteditor that aren't necessary.

But, due to the ease of WebKit use and the fact that I use it for HTML code snippets all the time too, I will add it in the next version. Thanks!

Colin D. Devroe on 12/23/2003:

Very cool, I plan on downloading this as soon as your site is accessible! Slow!! :) But awesome, nonetheless. Kudos.

Josha Chapman-Dodson on 12/29/2003:

xPad is sooooooo Coooooollllllllll!

I'm wondering how you did that note system where you click on a NSTableViewRow and it showed a different thing for each item on the NSTextView? Could you help me?
Thanks in advance.

Garrett on 12/29/2003:

Josha—

I use an NSMutableArray to store document content. A simplification of my structure would be an array that looks like this:

Key => Data

date => [date here]
category => [category here]
content => [content here]

All my data is coded, so I've got a coding class that en- and decodes data for me. This means that when I want to get something out of the array, I need to use the coding class like such (where Coder is the name of the coding class and items is the name of the mutable array mentioned above):

Coder * item = [items objectAtIndex:0];

For example purposes, I requested the object at row 0 directly, although in your code you would rarely do this. You'll see what I mean below. Anyway, now item can be used to get data from that row in the array.

When someone clicks on a row in the NSTableView, I run the delegate method:

- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row

Which will allow you to get the number of the row about to be selected. I do necessary checking on data here, and if the document has been changed, I save it. Then I always return YES. You might not need to use this method... you might be able to go straight to this one, which comes next:

- (void)tableViewSelectionDidChange:(NSNotification *)aNotification

You use this method to actually change the data in the NSTextView by loading the "content" data from the selected row into the textView. It's pretty easy, just do something like this (where text is the NSTextView and table is the NSTableView):

Coder * item = [items objectAtIndex:[table selectedRow]];
[text replaceCharactersInRange:NSMakeRange(0,[[text string] length]) withString:[item valueForKey:@"content"]];
[item release];

Now you can see what I was talking about when I mentioned using the item object to get data from that row in the array. In this method the selection has already changed, so you can use - (int)selectedRow to get the number of the currently selected row and use that to get the data from your array.

Doing things like this would be fine, but you'll want to put in some basic selection logic first. For instance, what happens now if someone selects empty space in your NSTableView? Well, assuming you allow for empty selection (you could turn this off in InterfaceBuilder), you'll get an error. That's because empty selection in a tableView will return -1 for selectedRow, and since you don't have data at that row in your array, this won't work. And what happens if you have multiple selection enabled and someone selects two rows?

For the purposes of this example, I'll add some conditions so that the data in the NSTextView will change only if one row is selected and it is not -1:

if (([table numberOfSelectedRows]==1) && ([table selectedRow]!=-1)) {
     // code from above goes here
}

Hopefully this will help you out. Let me know if you have other questions!

Reid on 01/02/2004:

Unfortunately I don't have access to a Mac so I can't even try out your new labour of love.

Congratulations nonetheless, it's a fantastic achievement!

Josha Chapman-Dodson on 01/08/2004:

This is probally in the same respect as my last post. I was recently messing around with xPad, and I noticed the Info thingie. Garrett how do you do that is Cocoa, so I can have a selected NSTableView row and have information in a drawer?


See Also

View the archive

Original iPod Introduction
How far we've come in just a few short years. Here's where it all started.

Front Row on Non-iMacs
Going to try this tonight!

WriAShorStorWe!
DY starts a one-week short story writing event for people to lazy to enty NaNoWriMo. VerCooIdea.

Lost Rhapsody
Funny Flash movie using Weird Al music and Lost stuff. Lyrics make a surprising amount of sense!

Jed's Other Poem
Unsolicited music video made on an Apple ][. Fantastic!

Printers Output Secret Barcode
The government is keeping tabs on what you print, with the help of major printer companies.

Dreamhost Promo Codes
DH already has very cheap, very good hosting—this just sweetens the deal.

Photos of the new iPod
Just received my new iPod and I put a few photos up.

PEZ MP3 Player
Funny idea that actually looks kind of neat. I like that it comes pre-loaded with "indie" music.

HD Easter Egg
"My Name is Earl" on NBC gives viewers with HD TVs a little easter egg. Cute, but weird.