Create NSWindow from Delphi OSX

How can I create a NSWindow in code in Delphi for OSX?

Here is what I've tried:

uses Macapi.AppKit,Macapi.CocoaTypes;


  NW : NSWindow;
  Nw := TNSWindow.Create;
  Nw.initWithContentRect(MakeNSRect(100,100,250,250), NSBorderlessWindowMask, NSBackingStoreBuffered, True);

But on the initWithContentRect line I get a runtime error in PAServer window "_setFrameworkScaleFactor called with non-nil _borderView".

I'm guessing I'm doing it wrong but I've found it hard to find any examples.


Thanks to the comment from RRUZ (in combination with the FMX source like Giel suggested) I managed to get it working:

uses Macapi.AppKit, Macapi.CocoaTypes, Macapi.ObjectiveC;


  Nw : NSWindow;
  Nw:= TNSWindow.Wrap(TNSWindow.alloc.initWithContentRect(
    MakeNSRect(0,100,100, 100),
    NSTitledWindowMask, NSBackingStoreBuffered, True));

  Nw.orderFront( (TNSApplication.Wrap(TNSApplication.OCClass.sharedApplication) as ILocalObject).GetObjectID );

Need Your Help

SQLite Exception - Create Table

android sqlite

I am getting an exception, and I just can't figure out why it is being thrown. The exception appeared when I added the Table Messages. Please give it a look, and see if there is a blunder I have mi...

Attempt to insert non-property value Objective C

ios objective-c nsmutablearray nsuserdefaults property-list

Hi l am trying to create a fourates lists from an restaurants Object, my application has a list of different restaurants, l want the ability for users to add favourate restaurants, and this code is...