Re: NSComboBoxCell and NSTableView
Re: NSComboBoxCell and NSTableView
- Subject: Re: NSComboBoxCell and NSTableView
- From: Ivan Myrvold <email@hidden>
- Date: Thu, 8 May 2003 11:53:04 +0200
I thought a little more, and found that I had to use the fieldEditor
for the cell, to grab my characters.
I had to do this:
NSText *fieldEditor = [[notification userInfo]
objectForKey:@"NSFieldEditor"];
NSString *mycombostring = [fieldEditor string];
Ivan
Pe torsdag, 8. mai 2003, kl. 10:59, skrev Ivan Myrvold:
>
Another problem, I add my window controller as an observer to
>
NSControlTextDidChangeNotification, and tries to get the stringvalue I
>
have typed in the NSTableView's comboCell, with: [comboCell
>
stringValue] in the selector.
>
>
The selector gets called, but the strange thing is that I do not get a
>
value from this. This works very nicely in a NSComboBox control
>
without problems, and I thought that the cell should do the same. Do
>
you have any idea why?
>
>
I just got a thought, the cell is shared in the NSTableView, can that
>
have something to do with it?
>
>
Here is the code:
>
>
- (void)windowDidLoad {
>
[[NSNotificationCenter defaultCenter] addObserver:self
>
selector:@selector(grabTheCellChars:) name:
>
NSControlTextDidChangeNotification object:myTableView];
>
}
>
>
- (void)grabTheCellChars:(NSNotification *)notification {
>
NSTableColumn *combocolumn = [[[notification object] tableColumns]
>
objectAtIndex:0); // this column is where I have comboboxcell
>
NSComboBoxCell *comboCell = [combocolumn dataCell];
>
int row = [[notification object] selectedRow];
>
NSString *mycombostring = [comboCell stringValue]; // THE STRING IS
>
EMPTY HERE EVEN AFTER TYPING SEVERAL CHARS
>
}
>
>
Ivan
>
>
Pe torsdag, 8. mai 2003, kl. 02:31, skrev Joseph Jones:
>
>
> I was having the same problem. My solution was to change the editable
>
> state in code with the following line:
>
>
>
> [cbCell setEditable:YES];
>
>
>
> Hope this helps.
>
>
>
> Thanx,
>
> joe
>
>
>
> On Wednesday, May 7, 2003, at 06:05 AM, Ivan Myrvold wrote:
>
>
>
>> I have tried to use NSComboBoxCell in a NSTableView, by using
>
>> setDataCell to an instance of NSComboBoxCell.
>
>>
>
>> The ComboBox shows up in the table view, but when I try to edit the
>
>> cell (the NSTextEdit part of it), I only get an audible pling, and
>
>> no letters appears. But I can click the button part of it, and it
>
>> shows the list.
>
>>
>
>> I see another message on this board about the same problem. Is this
>
>> a bug, or am I doing something wrong?
>
>>
>
>> Ivan C Myrvold
>
>> OrtopediService AS
>
>> Mob. 913 16 356
>
>> Tlf. 38 14 45 93
>
>> _______________________________________________
>
>> 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.
>
>>
>
Ivan C Myrvold
>
OrtopediService AS
>
Mob. 913 16 356
>
Tlf. 38 14 45 93
_______________________________________________
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.