Deprecated Declare?

Hi, This declare used to prevent my window from being dragged. Has this now been removed / deprecated, or is this somehow due to me now using an M1 Mac?

Thanks in advance.

Sub Open() declare sub setMovable lib "AppKit" selector "setMovable:" (windowRef as integer, value as Boolean) setMovable(self.handle, false) End Sub

You’d need to look at Apple’s docs.

Here’s the relevant page:

Seems that there are some caveats to it’s use, but it should be available from 10.6 and up

Now, if you’re trying to use it with a desktopWindow, you’ll need to change the type of handle from Integer to Ptr.

Changed Integer to Ptr and still fails on Monterey on M1 MacBook Pro :frowning:

declare sub setMovable lib "AppKit" selector "setMovable:" (windowRef as Ptr, value as Boolean) 
setMovable(self.handle, false)

Works fine in the DesktopWindow Opening event on macOS 12.1

I’m also using 12.1 on an M1 MacBook Pro.
When I paste the code into my Window open event - I get the following error message:

Very strange?

Check your super class is a DesktopWindow


When I change the super from Window to DesktopWindow, I get multiple error messages saying expects Integer but got Ptr.

I’ll have to just give up on the idea of making the window non-moveable.

Works in a brand new project, but not in older project files.

When I create a new project, the events are called opening, closing etc. In my old project file, the events are called open and close.

I am totally confused as to why this has changed??

In the old project files (the ones with Open) you would use the type of Integer. In the new projects (the ones with Opening) you would use the type of Ptr.

I think the new naming makes sense as the window is Opening, but not visible on the screen yet.

1 Like

Thanks Emily.