Moving or positioning an NSWindow (OS X, Cocoa)

Last edited on

Overview

This examples shows how to change the position of an NSWindow by using the Cocoa toolkit API from the test script:

Python example:

def main():
    startApplication(...)
    ...

    nsw = waitForObject({"title": "Squish Application Test", "type": "NSWindow", "visible": 1})
    nsw.setFrameTopLeftPoint_(NSPoint(100, 100))

JavaScript example:

function main()
{
    startApplication(...);
    ...

    var nsw = waitForObject({"title": "Squish Application Test", "type": "NSWindow", "visible": 1});
    nsw.setFrameTopLeftPoint_(new NSPoint(100, 100));
}

API documentation for NSWindow

API documentation for NSWindow.setFrameTopLeftPoint()