Re: Window Swap Code Broken in High Sierra?
Re: Window Swap Code Broken in High Sierra?
- Subject: Re: Window Swap Code Broken in High Sierra?
- From: Brian Christmas <email@hidden>
- Date: Fri, 11 Aug 2017 00:37:05 +1000
G’day Jim
In a preliminary test of my App, I found the same problem, but did not have
time to get back to it, too many alterations required for 10.12 as it was, and
I’m still going.
However, I’ve been wondering if the word ‘origin' now needs piping i.e. |origin|
Santa
> On 11 Aug 2017, at 12:04 am, Jim Mitchell <email@hidden> wrote:
>
> Hi all,
>
> I'm finding that the code included below, lifted pretty much verbatim from
> the AppleScript ObjC Explored 5 resource by Shane no longer works under macOS
> High Sierra. I've not had a ton of time to dig into, but when calling the
> method from another (the main app method), I get the following error:
>
> *** -[YasuAppDelegate doTheMagic:]: Can’t get origin of {{0.0, 0.0}, {500.0,
> 282.0}}. (error -1728)
>
> The code works like a champ under 10.11 and 10.12, but not 10.13. I'm curious
> to know if anyone else is seeing this in their app, and if so, what did you
> do to correct? Or, if you see the solution I'm missing, please point me in
> the right direction.
>
> Thanks!
>
> Code snippet:
>
> -- animate view swaps
> on animateView(theView) -- calling from another method, not a sender...
>
> set theFrame to theView's frame()
> tell my mainWindow
> set theFrame to its frameRectForContentRect:theFrame
> -- *** next line is where code breaks and won't continue... ***
> set {origin:{x:frameX, y:frameY}, |size|:{width:frameWidth,
> height:frameHeight}} to theFrame
> set {origin:{x:windowX, y:windowY}, |size|:{width:windowWidth,
> height:windowHeight}} to its frame()
> set newOrigin to {x:windowX - (frameWidth - windowWidth) / 2,
> y:windowY - frameHeight + windowHeight}
> set newFrame to {origin:newOrigin, |size|:{width:frameWidth,
> height:frameHeight}}
> set newFrame to my adjustFrame:newFrame
> forScreenOfWindow:mainWindow
> its setContentView:blankView
> its setFrame:newFrame display:true animate:true
> its setContentView:theView
> end tell
>
> end animateView
>
> -- adjust frame for view swap
> on adjustFrame:proposedFrame forScreenOfWindow:aWindow
>
> set {origin:{x:windowX, y:windowY}, |size|:{width:windowWidth,
> height:windowHeight}} to proposedFrame
> set screenFrame to aWindow's screen()'s visibleFrame()
> set {origin:{x:frameX, y:frameY}, |size|:{width:frameWidth,
> height:frameHeight}} to screenFrame
> if windowX < frameX then set windowX to frameX
> if windowX + windowWidth > frameX + frameWidth then set windowX to
> frameX + frameWidth - windowWidth
> if windowY < frameY then set windowY to frameY
> return {origin:{x:windowX, y:windowY}, |size|:{width:windowWidth,
> height:windowHeight}}
>
> end adjustFrame:forScreenOfWindow:
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> applescriptobjc-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden