Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
- Subject: Re: NSPopUpButtonCell -- I need an outlet to gain access to the button
- From: Dalton Hamilton <email@hidden>
- Date: Wed, 16 May 2007 13:36:05 -0400
Thanks for the reply, I'll look into -
tableView:setObjectValue:forTableColumn:row:data.
My objective is to give the user three possible choses in a table
column. So, I'd like to simply provide a popup type button that
provides the valid options for them to chose from. If you think I
should do this another way, please let me know -- I've only got a
couple days into the code at this point.
As for Bindings, I've never used them. I've taught myself Cocoa a
few years back and all the examples and samples I taught myself with
were this model -- i.e. not Bindings.
I've read a few articles regarding Bindings and they seem much faster
but also for the person who isn't an expert and someone working and
teaching themselves as they write apps for various reasons, Bindings
can be much harder to debug -- or it looks that way.
If I wanted to start moving toward "Bindings" do you have a
recommendation of where I should start? Doing a quick search on how
to use NSPopUpButtonCell with Bindings, I found the following URL:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Tasks/onerelation.html
I'll give it a try.
Thanks again.
Dalton Hamilton
On May 16, 2007, at 12:53 PM, I. Savant wrote:
Dalton:
I'm not sure why you're doing it this way, but if you're not using
Bindings, then you're already using the table data source methods, so
why not use the -tableView:setObjectValue:forTableColumn:row: data
source method to "do something"?
Maybe I'm unclear as to what you're actually trying to do (probably
because you haven't explained it ...), but it seems to me you're
making this more complicated than it needs to be. Again, without a
more thorough description of your problem, it's not clear how to solve
it.
--
I.S.
On 5/16/07, Dalton Hamilton <email@hidden> wrote:
Hello,
I'm trying to get an NSPopUpButton inside one of my columns of an
NSTableView. I've gotten really close but not quite there.
The NSPopUpButton shows by dong this:
NSTableColumn *typeSystemColumn;
NSPopUpButtonCell *cellSystemType;
cellSystemType = [[NSPopUpButtonCell alloc] init];
[cellSystemType setBordered:NO];
[cellSystemType addItemWithTitle:@"ESA"];
[cellSystemType addItemWithTitle:@"WSA"];
[cellSystemType setAction:@selector(systemTypeButtonAction:)];
[cellSystemType setTarget:self];
[cellSystemType setControlSize:NSSmallControlSize];
typeSystemColumn = [systemsTV tableColumnWithIdentifier:@"type"];
[typeSystemColumn setDataCell:cellSystemType];
[cellSystemType release];
The systemTypeButtonAction: method is called when I select the
button, however I don't know how to to get access to the
NSPopUpButton to figure out which index the user chose. The method
is defined as:
-(IBAction)systemTypeButtonAction:(id)sender
{
// sender is pointing to the NSTableView object. I need a way to
access the NSPopUpButton
// do something
}
And when it is called, the "sender" is the NSTableViw object. I need
something like an outlet.
Thanks a lot for any help. I've spent hours on the web trying to
figure this out -- I don't see any good (or complete) examples.
Dalton Hamilton
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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