• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trouble with NSComboBoxCell in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with NSComboBoxCell in NSTableView


  • Subject: Trouble with NSComboBoxCell in NSTableView
  • From: Michael Becker <email@hidden>
  • Date: Wed, 24 Dec 2003 14:08:50 +0100

Hi!

I am going crazy with NSComboBoxCell. To sort out my problems, I created a tiny program just to check if I use them correctly.
My problems are: The Comboboxes are displayed, but when I select an item, it's not displayed in the box. Also does direct editing work (after a double click), but when I hit Enter nothing happens and the box turns empty again.
Furthermore, my table rows are 70 pixels high, the combobox automatically stretches to fit that height, which is not wanted (The NSButtonCells center their buttons, so I figured that NSComboBoxCell would/could do that,too) I am developing under Panther, if this is of any importance.
The NSTableView is connected to the Controller via "delegate" and "dataSource".
I RTFM but that didn't really get me far, the sections on comboboxes are really short :-(
Maybe someone can direct me to an example code or give me direct hints at my mistakes?

Here is the code:

@implementation Controller

- (int)numberOfRowsInTableView:(NSTableView *)table
{ return 3; } // dummy value to have anything in the table

- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)ioCell forTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex;
{
}

- (id)tableView:(NSTableView*)table objectValueForTableColumn:(NSTableColumn*)col row:(int)rowIndex
{
return nil;
}

- (void)awakeFromNib {
NSTableColumn *column = [ table tableColumnWithIdentifier:@"combo"];

NSComboBoxCell *cell = [[ NSComboBoxCell alloc] init];
[ cell setEditable:YES];
[ cell addItemWithObjectValue:@"Item 1"];
[ cell addItemWithObjectValue:@"Item 2"];

[ column setDataCell:[ cell autorelease]];
}
@end

Bye,
Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Get milliseconds of current time
  • Next by Date: Re: Database Application with Obj-C
  • Previous by thread: Re: Get milliseconds of current time
  • Next by thread: Window resizing behavior
  • Index(es):
    • Date
    • Thread