Hello,
First, here is the code which I have problem with.
class AppDelegate:
on applicationWillFinishLaunching:aNotification
set items to current application's MSItems's alloc()'s init()
items's myOutlet's setHidden:true
end applicationWillFinishLaunching:
class MSItems:
property myOutlet : missing value
After the application launches i get the error: -[AppDelegate applicationWillFinishLaunching:]: myOutlet of «class ocid» id «data optr000000000038220000600000» can't understand the message "setHidden_". (error -1708)
I tried even with:
script AppDelegate
on applicationWillFinishLaunching:aNotification
current application's MSItems's alloc()'s init()'s didFinishLaunching()
end applicationWillFinishLaunching:
end script
script MSItems
property myOutlet : missing value
on didFinishLaunching()
myOutlet's setHidden:true
end didFinishLaunching
end script
And here I get the error: -[MSItems didFinishLaunching]: missing value can't understand the message "setHidden_". (error -1708)
The outlet is correctly connected in IB.
Hi,
if outlets of the class are defined in IB, do the following
¢ in the .xib file drag an object (blue cube) into the object view.
¢ Change the class name of the object to MSItems
¢ in AppDelegate add a property
property msItems : class MSItems
then you can write
on applicationWillFinishLaunching:aNotification
msItems's myOutlet's setHidden:true
end applicationWillFinishLaunching:
item is a reserved word, either you use pipes (|items|) or choose an other name as I did
Hi,
thanks for the help.
I already had the blue cube in IB, in fact the outlet is connected to that cube.
I added the line
property msItems : class "MSItems"
but as soon as the app starts, suddenly all the outlet connected to the class MSItems disconnect. Here’s a little part of the log:
[code]Unknown class ‘MSItems’, using ‘NSObject’ instead. Encountered in Interface Builder file at path /Users/Me/Library/Developer/Xcode/DerivedData/App_Name-enomcrajcidxpygksgpxejpkrycv/Build/Products/Debug/App Name.app/Contents/Resources/Base.lproj/MainMenu.nib.
Failed to connect (accView) outlet from (NSObject) to (NSView): missing setter or instance variable
Failed to connect (addButton1) outlet from (NSObject) to (NSButton): missing setter or instance variable[/code]
If I delete that property, all connects well.
if you have the blue cube then the class is instantiated automatically when the nib is loaded and you can access the class with class MSItems or using the mentioned property from AppDelegate, you must not write alloc init
Still doesn’t work.
If I add the property class “MSItems” or add in the applicationWillFinishLaunching method a property like set msItems to class “MSItems”, the outlets disconnect. But if i call an MSItems’s method before setting the property class “MSItems”, the outlets don’t disconnect.
I tried even with:
current application's (class "MSItems")'s myOutlet's setHidden:true
-- or
current application's MSItems's myOutlet's setHidden:true
and get -[AppDelegate applicationWillFinishLaunching:]: [<MSItems 0x618000252cc0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key myOutlet. (error -10000)
and with:
class "MSItems"'s myOutlet's setHidden:true
getting -[AppDelegate applicationWillFinishLaunching:]: couldn't get (error -1728)
I got the solution:
in AppDelegate create a property
property msItems : missing value
and connect this outlet to the blue cube of the class MSItems
Thank you Stefan, now works very well!