Re: Wrong type of button in IB?
Re: Wrong type of button in IB?
- Subject: Re: Wrong type of button in IB?
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 16 Jun 2005 12:59:21 -0700
On Jun 16, 2005, at 12:34 PM, Julio Cesar Silva dos Santos wrote:
You should declare myButton the way Interface Builder does with
every outlet it creates:
IBOutlet id myButton;
Umm, no, this has several faults:
(a) It is *in general* good practice to strongly type outlets (and
indeed all variables) so that you can get compiler warnings if you
try to send an object inappropriate messages;
(b) Analogous, and more relevant to the current situation: Interface
Builder will prevent you from making in incorrect connection;
(c) If you're trying to make an NSButton connection to something that
looks like a button, but which Interface Builder informs you is not a
button, the correct response is to find out why IB thinks it's not a
button, not to ignore what IB's telling you. Or in general to find
out what the mismatch is between your code and what IB is doing.
There are many possible issues here:
Firstly, has IB been kept in sync with the header? Simply changing
the .h file does not update IB's view of the world. You must re-
import the header.
Secondly, what connection are you trying to make? A button or a
table view? If a button, then the variable should be declared:
IBOutlet NSButton *outletName;
If a table view, then:
IBOutlet NSTableView *outletName;
Once you have that set correctly (and imported the .h file into IB if
necessary) then what is actually happening when you try to make the
connection?
If you're trying to connect to something that looks like a button, is
it actually a button? Does IB provide a tooltip that tells you what
you're trying to connect to? **If at some stage you have made a
matrix of buttons, but then reduced the matrix down to a single
instance, you don't have a button, you have an NSMatrix containing a
single NSButtonCell.**
If you're actually trying to connect to a table view, again as you
Control-drag are you trying to connect to the right thing? Is the
destination the table view, the scroll view that contains the table
view, or perhaps a table column?
mmalc
_______________________________________________
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