Windows and nibs and dialogs, oh my!
Windows and nibs and dialogs, oh my!
- Subject: Windows and nibs and dialogs, oh my!
- From: William Squires <email@hidden>
- Date: Tue, 2 Mar 2010 20:13:07 -0600
Please help, I'm still a bit fuzzy on how to open a window in Cocoa/
ObjC. I realize there's a correlation between a nib, the window you
design(ed) in IB, and the .h/.m files for the controller class, but
how do you actually USE this stuff? i.e. If I wanted to make a window
in REALbasic, I would design the window's UI, put in a publicly
accessible Display() method that did something like:
Public Sub Display()
// Setup control's states based on available info (this window's
class' properties)
Me.Setup()
// This is a modal window to allow the player to roll a new player-
character
Me.ShowModal()
End Sub
Then, somewhere else, I would do:
Dim w As wndRollNewPC
Dim theNewPC As PlayerChar
theNewPC = nil
w = New wndRollNewPC()
w.DefaultPlayerName = "<untitled PC>"
w.UseDefaultRules = True
w.Display()
theNewPC = w.NewPC
w = nil
If (theNewPC = nil) Then
// Player somehow aborted
Exit Sub
End If
...
And the call "w.Display() would make the window visible and frontmost
(or, in Cocoa terms, it would load the nib, then - somehow - make it
(the window, not the nib!) visible, and set one of the controls to be
FirstResponder. It would also hook up the FilesOwner proxy object
reference.)
What I want to know is how to get this bit of magic to work? Am I
going to have to chant arcane phrases over my keyboard while moving
my mouse just so? :) This gets even more confusing on the iPhone, BTW.
A compiler is a tool for turning source code into error messages;
generating machine language bytes is just a fortuitous by-product!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden