Re: object type testing
Re: object type testing
- Subject: Re: object type testing
- From: Boyd Collier <email@hidden>
- Date: Sun, 7 May 2006 12:53:57 -0700
By chance, when this topic was begun, I was writing some code to
handle users make selections in a dialog containing a set of radio
buttons and also a bunch of check boxes. My code has a method that
gets called whenever the user hits one of these in the dialog. In
very abbreviated form, it looks like this:
- (IBAction)doGroupsChecks:(id)sender {
if ([sender isMemberOfClass:[NSMatrix class]]) {
// find out which button was hit by calling [onButton tag] and do
appropriate stuff
...
}
if ([sender isMemberOfClass:[NSButton class]]) {
// do stuff to keep track of which check box was hit
...
}
}
In my simple testing, the above seems to work as I expect and has
the (small) advantage of not having to worry about mixing up tags
used to distinguish different radio buttons in that set with tags
used for my check boxes. But having read the various messages on
this topic, I'm wondering whether (1) I'm going to get into trouble
by using isMemberOfClass, and (2) whether, in my inexperience with
cocoa, I'm totally overlooking an entirely different and more
straightforward approach.
Boyd
_______________________________________________
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