Hi there
I am attempting to create a round window, and from what I have read, and found in threads here, this should work.
================
// Declare what we needDeclare Function NSClassFromString Lib “AppKit” (clsName As CFStringRef) As PtrDeclare Function sharedApplication Lib “AppKit” Selector “sharedApplication” (clsRef As Ptr) As PtrDeclare Function mainWindow Lib “AppKit” Selector “mainWindow” (appRef As Ptr) As PtrDeclare Function contentView Lib “AppKit” Selector “contentView” (windowRef As Ptr) As Ptr
Declare Function CGPathCreateWithEllipseInRect Lib “CoreGraphics” (ByRef rect As CGRect, transform As Ptr) As PtrDeclare Sub setWantsLayer Lib “AppKit” Selector “setWantsLayer:” (view As Ptr, flag As Boolean)Declare Function layer Lib “AppKit” Selector “layer” (view As Ptr) As PtrDeclare Sub setMask Lib “QuartzCore” Selector “setMask:” (layerRef As Ptr, maskLayer As Ptr)
Declare Function NSClassFromStringCA Lib “QuartzCore” Alias “NSClassFromString” (clsName As CFStringRef) As PtrDeclare Function layerWithPath Lib “QuartzCore” Selector “layerWithPath:” (classRef As Ptr, path As Ptr) As Ptr
// Get referencesVar winRef As Ptr = mainWindow(sharedApplication(NSClassFromString(“NSApplication”)))Var viewRef As Ptr = contentView(winRef)
// Enable CoreAnimationsetWantsLayer(viewRef, True)Var mainLayer As Ptr = layer(viewRef)
// Make a circle path the size of the windowVar r As CGRectr.x = 0r.y = 0r.width = Self.Widthr.height = Self.Height
Var circlePath As Ptr = CGPathCreateWithEllipseInRect(r, Nil)
// Build a mask layer from that pathVar shapeLayerClass As Ptr = NSClassFromStringCA(“CAShapeLayer”)Var maskLayer As Ptr = layerWithPath(shapeLayerClass, circlePath)
// Apply it as a masksetMask(mainLayer, maskLayer)
=====================
I have created a structure in the program, called CGRect. It is NOT a structure in the window.
I am also using a plain window with no title bar.
Sorry about the formatting but when I try to use the code item… it looks REALLY weird!
Any ideas?
Regards





