• 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
Re: String not showing up in Table
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String not showing up in Table


  • Subject: Re: String not showing up in Table
  • From: Philipp Ringli <email@hidden>
  • Date: Thu, 3 Feb 2005 16:27:03 +0100

Uhh... I found an answer to one of my questions:
The Problem with the string not showing in the table textfield.
I had:
-(id)classPathTable:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { ...


But it should've been:
-(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { ...


Since the Author of this tutorial...
http://www.macdevcenter.com/pub/a/mac/2001/08/10/cocoa.html?page=1
... was using tableView for the outlet name of the NSTableView, I got confused. I think that wasn't a lucky name pick by the author!


Maybe someone can enlighten me on my other questions...

Phil

... forgot to add the lower two methods to my last email.
Here's the code again:

Controller.m:
----------------------------------------------------------------
-(NSDictionary *)createRecord
{
	NSMutableDictionary *record = [NSMutableDictionary dictionary];
	[record setObject:@"Please enter Classpath..." forKey:@"classpath"];
	return record;
}

- (IBAction) addRecord:(id) sender
{
	[classPathRecords addObject:[self createRecord]];
	[classPathTable reloadData];
	//NSLog (@"\nclassPathRecords:%@", classPathRecords);
}

-(void)awakeFromNib
{
	classPathRecords = [[NSMutableArray alloc] init];
}


- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
//NSLog (@"\naTableView:%@\ncount:%@", aTableView, [classPathRecords count]);
return [classPathRecords count];
}


-(id)classPathTable:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
id theRecord, theValue;
NSLog (@"\naTableColumn identifier:%@", [aTableColumn identifier]);
theRecord = [classPathRecords objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:[aTableColumn identifier]];
return theValue;
}



On 03.02.2005, at 10:52, Philipp Ringli wrote:

I am trying hard to get my table to work. ;-)
The table has two colums, one with a textfield, and one with a check box.


Is this the right way to set the textfield in the table to "Please enter Classpath..."?
(The user clicks the Add button and a new row is inserted, that he then should edit.)


How do I go about adding the value for the check box column to the dictionary (record)?

Right now, when I add a row using the Add button, a row is added, but there's no "Please enter Classpath..." in the textfield.
And I can't check the check boxes.


Thanks,
Phil

_______________________________________________ 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



_______________________________________________ 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
References: 
 >String not showing up in Table (From: Philipp Ringli <email@hidden>)
 >Re: String not showing up in Table (From: Philipp Ringli <email@hidden>)

  • Prev by Date: Re: Method not seeing array as array[solved]
  • Next by Date: Re: NSCalendarDate picker widget?
  • Previous by thread: Re: String not showing up in Table
  • Next by thread: Stop dragging my <NSWindow> around
  • Index(es):
    • Date
    • Thread