Nice video too. Your’e the pioneer so far. I tried using a list of lists rather than a record to add to the datasource with no luck. Does the NSMutableArray only accept records. Ok if so, I am just used to using the list approach in ASS.
Looking forward to User defaults and saving of the book list. Normally I would try to figure all this out but am still over my head. I know the basics only of OBJ-C but am reading up on it and Cocoa…
No, NSMutableArray will accept objects, other arrays, dictionaries, etc. The reason you use an array of dictionaries ( “records” ) is that the columns always have the same data even when the user rearranges their columns. That is why you match up the column identifier with the “key” in the record. As an example, say the user moved the “Status” column in our app to the far right. If you were using an array instead of a record, the app would crash. Column 1 no longer has an NSImage cell to receive our image. Column 1 is now the “Book Title.” Make sense?
Part 4 will include saving the book list but I am not sure yet whether it will have User Defaults. I think User Defaults will be one on its own.
Cool. I noticed you had to release the memory at the end. Does that mean AppleScriptObjC can’t work with garbage collection? Or is that just your choice of programming-style?
I have not been able to get this to work - the Author’s name fails to show up in the TextView when I add new books.
When I tried building the project downloaded from MacScripter there was the same defect. I am wondering if there is something wrong with the way I have XCode set up, because I suspect the code, bindings etc. is correct.
Any ideas would be very welcome - I don’t want to move on to the next part until I can get this to work.
Model: MacMini
AppleScript: 2.1
Browser: Safari 6531.9
Operating System: Mac OS X (10.6)
In the downloaded example, when I entered a new book title, then the author, the Author name did not get carried into the text view. The problem is that the app was not “getting” the title until I had exited the second Text Field.
When I added the line
tell bookTitleField to selectText_(me)
(taken from PartFour) the change made the PartTwo project behave as it should.
An alternative fix (which Craig gave me offline) is to adjust the bindings of the Text Field to ‘Continuously Updates Value’.
This sequence of tutorials is very helpful - it’s pretty much all new to me - and Craig’s willingness to keep helping is welcome and generous. For my part, I am used to being an expert contributor (Excel VBA) and the switch to total bozo here is awkward.
I created a new website since this tutorial was made and my re-direct is not working properly. I have updated the links in this tutorial to the new location so please try again.
I’m getting the following from console log, though this does compile pretty much ok
2011-03-25 12:24:27.900 ColorTable[59123:a0f] *** -[ColorTableAppDelegate tableView:objectValueForTableColumn:row:]: The variable theValue is not defined. (error -2753)
The Status column doesn’t set the picture. At one point it stopped compiling and I narrowed it down to this section
on tableView_objectValueForTableColumn_row_(aTableView, aColumn, aRow)
if theDataSource's |count|() is equal to 0 then return end
set ident to aColumn's identifier
set theRecord to theDataSource's objectAtIndex_(aRow)
set theValue to theRecord's objectForKey_(ident)
if ident's isEqualToString_("theStatus") then
if theValue's intValue() = 0 then
set theValue to NSImage's imageNamed__("green")
else
set theValue to NSImage's imageNamed__("red")
end if
end if
return theValue
but then it started compiling again
Any help?
AppleScript: xcode 3.2.6
Browser: Safari 534.16
Operating System: Mac OS X (10.6)
@tempistraven - That site is also no longer maintained and I have not updated the video or located the original. If I do locate the original, I will post a link here.
FYI: Some of the links to videos in this thread appear to possibly be redirecting to malware. I clicked on one of the allencraig links, and it immediately downloaded a flash installer dmg without my authorization. No, thanks.
Thanks, Marc. That’s a distinct possibility, given the age of most of the articles in unScripted. I’ll post a cautionary note and see if I can persuade an administrator to make it a sticky.
hello
all links are dead… i know you know
but maybe someone can send the xcode projet just for understand the binding connexions.
or maybe just explain again.
thank you in advance.
best .
jf