Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Xcode ApplescriptObjC display sizes

I have written an ASOC project which when displayed on my 27" iMac fits exactly but when viewed on my MacBook some of the display is lost. Is there a way to automatically correct display size depending on screen size. Any guidance would be gratefully received.

Posted on Nov 14, 2017 3:33 AM

Reply
6 replies

Nov 14, 2017 8:46 AM in response to VikingOSX

Many thanks for quick reply but cannot get this to work and not sure where to place the code. When I place it at the beginning (before applicationWillFinishLaunching_(aNotification)) it compiles but has no effect on display. If I add the code within the processing it fails to compile with the error Can’t get |size| of {«class form»:«constant ****usrp», «class want»:property, «class seld»:"frame", from:«class ocid» id «data

Sorry to be dim but as you can tell ApplescriptObjC is not my strong point!

Nov 14, 2017 1:00 PM in response to Frinton Fogey

I would put the code in the applicationDidFinishLaunching handler.


Perhaps the following, to set the window to the current screensize.


set screenFrame to current application'sNSScreen'smainScreen()'s frame

set win to current application'sNSWindow'salloc()'s initWithContentRect:screenFramestyleMask:3 backing:(current application'sNSBackingStoreBuffered) defer:false


tell win

its setDelegate:(me)

its setBackgroundColor:(current application'sNSColor'swhiteColor)

its setCollectionBehavior:(current application'sNSWindowCollectionBehaviorFullScreenPrimary)

its toggleFullScreen: (me)

its setReleasedWhenClosed:true

end tell

Nov 15, 2017 8:25 AM in response to VikingOSX

Found the close button at the top of the blank window but when I close that window it then displays the required window but cropped as before. Looks like I am going to have to have two versions each with their own screen size determined through the Size Inspector. I cannot believe that this a problem unique to me, surely the same project can run on different device screen sizes and detect those screen sizes, thanks for your help anyway.

Xcode ApplescriptObjC display sizes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.