I have decided to break my application into multiple applescript files. I added a new applescript file via the menu “File/New File…” For simplicity I’ll call the original applescript file, “ClassA_AppDelegate” and the new file, “ClassB”.
Both files have many (many) properties that are connected to IBObjects in multiple windows/panels. In IB added a “Mr. Blue Box” and connected that up to “ClassB”. ClassB properties are connected to IBObjects in a panel I’ll call “bPanel”. There is a window that is connected to a property in ClassA_AppDelegate that I’ll call “aWindow”.
I have successfully called a method in ClassB from ClassA_AppDelegate and passed a record to the method in ClassB. I need to have the panel bPanel display in front of the window aWindow. I have the following line in ClassB’s method:
tell bPanel to orderFront_(current application's ClassA_AppDelegate's aWindow)
This gives me the following error message:
2012-01-12 19:34:22.815 Class A[386:1307] *** +[ClassB displayIndividualTeamStats:]: missing value doesn’t understand the orderFront_ message. (error -1708)
“displayIndividualTeamStats” is the method being called. I see that the message refers to “missing value” so I think I am missing a link between ClassA_AppDelegate and ClassB somewhere but I’m not sure where.
Some additional information: I have used the “orderFront_” method in ClassA_AppDelegate without a problem. As a test I had bPanel set to visible at launch to test that a button connected to an action in ClassB worked and it does.
It’s a little hard to tell what you’re doing without seeing more code, but if you want bPanel to be in front, I don’t know why you need to refer to aWindow at all. Have you tried “tell bPanel to orderFront_(me)” ? Also, are you sure that the property bPanel is actually connected to the panel in question? I was able to duplicate your error message by having a property called bPanel, but not connecting it to anything.
That returns your class, not an instance of it, so it can’t have properties. You can make a property in Class B and connect it to the relevant instance, or use this:
I tried the orderFront_(me) → no love. I made sure that bPanel is properly connected. Both good suggestions.
@ Shane
I thought that was the case (returning the class, not an instance) but I wasn’t sure. I made a property in ClassB, mainAppDelegate, and in IB connected it to “Mr. Blue Box” for ClassA_AppDelegate. I changed the line in ClassB to the following:
tell bPanel to orderFront_(mainAppDelegate's aWindow)
I get this error:
2012-01-12 21:25:10.565 ClassA_AppDelegate[557:1307] *** +[ClassB displayIndividualTeamStats:]: missing value doesn’t understand the orderFront_ message. (error -1708)
Again, missing value is bugging me. I’m sure I’m overlooking something simple. I thought I had checked all relevant connections. I will have to keep digging.
I have a number of properties defined in ClassB and properly linked to text fields in bPanel. I have checked to make sure the links are in place and they are. I get the following error:
where theTeamName is a property, defined in ClassB, linked to a text field in bPanel. theTeam is a record, passed to the method in ClassB from ClassA_AppDelegate. I have checked and the key/value pairs are intact. I checked that by logging theTeam’s teamName (teamName is one of the keys in the record).
Could I have missed a step in creating/adding a new Class file and creating an instance of said class in IB?
How did you do that? How are you referencing classB from your app delegate? Do you have a property in your app delegate that’s connected to the classB blue cube in IB? I noticed in your original post that there is a plus sign in the error message ( +[ClassB displayIndividualTeamStats:]). I’m guessing that you’re accessing ClassB using “current application’s ClassB” which accesses the class but not the instance that has all the hook ups in IB. You need a property hooked up to the ClassB blue cube to be talking to the instance. Unlike Objective-C, there’s no clear differentiation between class methods and instance methods in ASOC, so you can call a method in another class using “current application’s ” or with a property that’s hooked up to the instance. The first way will allow you to access the methods but not the instance variables, including the IBOutlets.
Thanks Ric, that was the missing piece of the puzzle. I too noticed the “+” in the error message, but I’m not that adept in ObjC and the “missing value” in the message kept my attention. I understand the concept of “class” and “instance” but putting the difference into practice is still fuzzy at times.
Now that I know how this works, I’ll be able to break my application down into more manageable pieces.