Re: Wrong type of button in IB?
Re: Wrong type of button in IB?
- Subject: Re: Wrong type of button in IB?
- From: Andy Lee <email@hidden>
- Date: Thu, 16 Jun 2005 15:35:47 -0400
On Jun 16, 2005, at 3:09 PM, Mark Dawson wrote:
On Jun 16, 2005, at 11:21 AM, Andy Lee wrote:
You need to declare the outlet appropriately for the type of
object you want it to connect to, and you should probably name it
appropriately while you're at it, something like this:
IBOutlet NSTableView* myTable; //
NSTableView
Changing "myButton" to NSTableView* just changes the error to
"myButton must be of type NSTableView".
Please, for sanity's sake, name instance variables in a way that
makes sense. It makes no sense to call a table a button.
Note that IB DOES allow me to connect up "myButton" to the
"outletThatWorks" method variable…
Do you mean an instance variable? When you say "myButton" do you
mean the button that is visually displayed in IB? If so, then this
makes perfect sense. You have an outlet declared to be of type
NSButton. You connect it to an object in IB that *IS* an NSButton.
I suggest you start with a clean slate. Disconnect any outlets
you've already connected in IB -- there may be some invalid
connections left over from your previous attempts. Then re-read your
controller's .h file into IB.
Now: my impression was that you want your controller to have two
outlets, one that connects to a button that you created in IB, and
one that connects to a table, also in IB. You already know how to
declare the outlets in your .h file. I assume you know how to tell
IB to read your .h file, and thereby learn what the outlets of your
class are. You've already created a button (i.e., an instance of
NSButton) and a table (an instance of NSTableView) in IB. Now you
just want to make the corresponding connections.
IB won't let you make a connection from an outlet to an incompatible
type. So if you declared outletThatWorks to be an NSButton, you can
connect it to an NSButton but not to an NSTableView. But that should
be okay, because didn't you *want* it to connect to the button?
By the same token, you should be able to connect myTable (I refuse to
call it myButton) to the table but not to the button. Are you saying
that's not true?
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden