Displaying Text in a window

So I have been scouring the Objective-C documentation and Googling all over the place, but I can’t seem to figure out how to display text in a window.

Here is the code that sets up and displays the window (this is not my code, it is something I found on a Keyboard Maestro form and did some modifications on).

tell (NSWindow's alloc()'s ¬
			initWithContentRect:{{theWidth, theHeight}, {640, 480}} ¬
				styleMask:NSBorderlessWindowMask ¬
				backing:NSBackingStoreBuffered ¬
			setBackgroundColor_(NSColor's grayColor())
			delay 5
		end tell

I’d like to use this as an alert, so displaying text in a large size would be great. But at this point I’d be happy to display text of any size in that window just to get me started on the right path.

I can post the entire script if it helps.


You need to create an NSTextField and add it to your window’s contentView. But if you’re using Xcode, you’d be better to do it in its Interface Builder.