script TestInstancePropsNeedObjToSetAppDelegate
property parent : class "NSObject"
on applicationWillFinishLaunching_(aNotification)
set theObj1 to current application's Test1's makeTest1__("TEST1a", "TEST1b")
set theObj2 to current application's Test1's makeTest1__("TEST2a", "TEST2b")
theObj1's DisplayMe()
theObj2's DisplayMe()
log "--------------"
theObj1's |description|()
theObj2's |description|()
current application's NSApp's terminate_(me)
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
script Test1
property classProp : missing value
property instProp1 : missing value
property instProp2 : missing value
on makeTest1__(val1, val2)
set my classProp to "CLASS VALUE"
set my instProp1 to "CLASS VALUE1 FOR INSTANCE"
set my instProp2 to "CLASS VALUE2 FOR INSTANCE"
set newObj1 to current application's Test1's alloc()'s init()
set newObj1's instProp1 to val1 as string
newObj1's InitMe_(val2)
return newObj1
end makeTest1__
on InitMe_(aVal)
set instProp2 to aVal as string
end InitMe_
on DisplayMe()
log "DisplayMe() my classProp: " & my classProp & ", my instProp1: " & my instProp1 & ", my instProp2: " & my instProp2
end DisplayMe
on |description|()
log "description() my classProp: " & my classProp & ", my instProp1: " & my instProp1 & ", my instProp2: " & my instProp2
end |description|
end script
DisplayMe() my classProp: CLASS VALUE, my instProp1: TEST1a, my instProp2: TEST1b
DisplayMe() my classProp: CLASS VALUE, my instProp1: TEST2a, my instProp2: TEST2b
--------------
description() my classProp: CLASS VALUE, my instProp1: CLASS VALUE1 FOR INSTANCE, my instProp2: CLASS VALUE2 FOR INSTANCE
description() my classProp: CLASS VALUE, my instProp1: CLASS VALUE1 FOR INSTANCE, my instProp2: CLASS VALUE2 FOR INSTANCE