Accessing the Cocoa Application 'object'

For a window we can user window:handle with Cocoa declares in order to use selectors like “setFrame:display:animate:”. Is there an equivalent for the application object. For example to use the “showHelp:” selector I’m currently having to do this:

[code]Declare function NSClassFromString lib “Cocoa.framework” (aClassName as CFStringRef) as Ptr
Declare function sharedApplication lib “Cocoa.framework” selector “sharedApplication” (class_id as Ptr) as Ptr
Declare function showHelp lib “Cocoa.framework” selector “showHelp:” ( appid as Ptr ) as Boolean

Return showHelp( sharedApplication( NSClassFromString(“NSApplication”) ) )
[/code]

It would obviously be neater to do the equivalent of this:

[code]Declare function showHelp lib “Cocoa.framework” selector “showHelp:” ( appid as Ptr ) as Boolean

Return showHelp( App:handle )
[/code]

Any hints would be welcome.

Agreed it would be neater, but currently you’re doing it right with the first segment. I’d suggest logging a feedback request.

Added as <https://xojo.com/issue/27788>

Thanks
Ian

If I understand correctly, using NSApplication.App from the macoslib project will give you that Application object you’re looking for.

Thanks, I’ll take a look.