I have run into an AppleScriptObjC puzzle.
Both of the following script pieces work and appear to work identically.
global backgroundColor, gridColor, linesColor
property NSAffineTransform : class "NSAffineTransform"
property NSBezierPath : class "NSBezierPath"
property NSColor : class "NSColor"
script BezierView
property parent : class "NSView"
on initWithFrame_(frame)
continue initWithFrame_(frame)
set backgroundColor to NSColor's whiteColor
set gridColor to NSColor's blackColor
set linesColor to NSColor's redColor
return me
end initWithFrame_
...
property NSAffineTransform : class "NSAffineTransform"
property NSBezierPath : class "NSBezierPath"
property NSColor : class "NSColor"
script BezierView
property parent : class "NSView"
property backgroundColor : NSColor's whiteColor
property gridColor : NSColor's blackColor
property linesColor : NSColor's redColor
on initWithFrame_(frame)
continue initWithFrame_(frame)
return me
end initWithFrame_
...
Here is the puzzle: “Build and Run” work fine for both scripts, but for the second script, “Complile” in the Build menu generates an error: “Can’t make whiteColor of class “NSColor” into type reference.”
What is the real difference? Is the error an Xcode bug?
EricN