[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Main.sc and stand-alone application




On 26 Dec 2008, at 05:31, James Harkins wrote:

This latest error isn't your fault. It's trying to add items to the Help menu but I would guess that the Help menu on your system is named something other than "Help." In that case, it appears in the objective-c source that it will fail to find the menu and return a wrong type error.

As a temporary workaround, go into OSXPlatform and comment out this line from the startup method:

Help.addToMenu;


Scott W, whoever else was working on the help tree, seems to me we at least need to put *addToMenu in a try block and post a warning on failure. This kind of thing shouldn't be fatal.

I knew there was a potential issue with standalones, but hadn't thought best how to deal with that. Under normal circumstances this would not fail. Your try block won't really do for the standalone case as it will post an unwanted warning. One obvious answer is you edit it out if you don't want it, like everything else in a standalone.

I can't recall: Is there a way of detecting if you're in a standalone?


Beyond that, locale awareness would be nice but I have no idea how to do it.

Me neither.

Maybe there is an alternative to itemWithTitle here?

Nothing obvious. It searches by title in fact because menu order might be unpredictable. It could do it by index, but then that breaks if anyone adds a menu in a class or uses a different nib.

Or the obj-c layer might have access to the system locale.

if (strcmp(parentSymbol->name, "Help")==0) {
parentMenu = [[[NSApp mainMenu] itemWithTitle:@"Help"] submenu];


I don't know how to access the localisation stuff. There's also a potential unicode issue here, since I'm not sure you could specify the actual name.

Since at the moment there is only English and Japanese, you could search for both I suppose. Another possibility is that the if clause above exits without fail if the Help menu is not found. Not sure if that's a good idea or not. Maybe depends upon whether altering existing menus remains 'private'.

S. 

hjh


On Dec 26, 2008, at 2:27 AM, Usami Tadashi wrote:

Sorry to bother you over and over again...
I downloaded 3.3 alpha, unzipped, and installed into /Applications.
I put myApp.rtf in /Applications/SuperCollider.
I changed?/Applications/SuperCollider/SCClassLibrary/DefaultLibrary/Main.sc
with addition of:
interpreter.executeFile(String.scDir ++ "/myApp.rtf");
Then, I was able to start up SC, just as usual. My application didn't come up.
The post window says:
ERROR: Primitive '_NewMenuItem' failed.
Wrong type.
RECEIVER:
Instance of CocoaMenuItem {? ? (154D7B00, gc=EC, fmt=00, flg=00, set=03)
? instance variables [7]
? ? dataptr : RawPointer 55D950
? ? name : "Help Tree"
? ? parent : Symbol 'Help'
? ? children : nil
? ? state : false
? ? isBranch : true
? ? action : nil
}
CALL STACK:
MethodError:reportError ? 15573B90
arg this = <instance of PrimitiveFailedError>
Nil:handleError ? 15571670
arg this = nil
arg error = <instance of PrimitiveFailedError>
Thread:handleError ? 15576320
arg this = <instance of Thread>
arg error = <instance of PrimitiveFailedError>
Object:throw ? 15574910
arg this = <instance of PrimitiveFailedError>
Object:primitiveFailed ? 15572030
arg this = <instance of CocoaMenuItem>
CocoaMenuItem:init ? 15E36190
arg this = <instance of CocoaMenuItem>
arg argparent = 'Help'
arg argindex = 8
arg argname = "Help Tree"
arg hasSubmenu = true
arg argaction = nil
< FunctionDef in Method Meta_Help:addToMenu> ? 15E360F0
arg parent = 'Help'
arg dict = <instance of Dictionary>
arg name = "Help Tree"
arg index = 8
var menu = nil
var keys = nil
Meta_Help:addToMenu ? 155D11E0
arg this = class Help
var ugens = nil
var menu = nil
var addSubMenu = <instance of Function>
OSXPlatform:startup ? 154C3C20
arg this = <instance of OSXPlatform>
Main:startup ? 154C3BC0
arg this = <instance of Main>


Maybe I made a very stupid mistake. Any hints?

Tadashi


: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman