I hope the table column show the values after I pressed the button. The following is the IBAction Button.
- (IBAction)buttonTapped:(id)sender
{
//Filling the arrays
Test_name = [NSArray arrayWithObjects:@"test_item_a",@"b",@"c",@"Current",nil];
Min = [NSArray arrayWithObjects:@"0.5",@"0.7",@"0.8",@"100",nil];
Max = [NSArray arrayWithObjects:@"5",@"5",@"9",@"140",nil];
uint16 index = 0;
NSInteger i = 0;
//Show_Datagrid this function move the above values to another 3 arrays table_item,
//table_min, table_max. And the following code is just to verify the value.
[self Show_Datagrid:index];
[self showMeg:@"Button Tapped!2\n"];
[self showMeg:[table_item objectAtIndex:0]];
[self showMeg:@"\n"];
[self showMeg:[table_min objectAtIndex:0]];
[self showMeg:@"\n"];
[self showMeg:Column_test_item.identifier];
//call this function to show the values in tableview.
[self tableView:_tableview objectValueForTableColumn:Column_test_item row:i];
}
following is the function (Column_test_item.identifier is verified correct.):
-(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([aTableColumn.identifier isEqualToString:@"no"])
return [table_no objectAtIndex:rowIndex];
if ([aTableColumn.identifier isEqualToString:@"item"])
return [table_item objectAtIndex:rowIndex];
if ([aTableColumn.identifier isEqualToString:@"min"])
return [table_min objectAtIndex:rowIndex];
if ([aTableColumn.identifier isEqualToString:@"max"])
return [table_max objectAtIndex:rowIndex];
if ([aTableColumn.identifier isEqualToString:@"value"])
return [table_value objectAtIndex:rowIndex];
if ([aTableColumn.identifier isEqualToString:@"status"])
return [table_status objectAtIndex:rowIndex];
return [table_no objectAtIndex:rowIndex];
}
I thnik I called that function in wrong way. Shouldn't I input NSTableColumn parameter Column_test_item
directly? Column_test_item
is an IBOutlet I connected to the specfic test item column.
And how does this function know which column it want to fill up the value, based on the second parameter I input?