[Mono-osx] NSTableView in monomac
gareth.baker at stfc.ac.uk
gareth.baker at stfc.ac.uk
Fri Aug 20 08:03:47 EDT 2010
Hi,
I'm trying to use an NSTableView from monomac. I can get the code to
compile with the two delegate functions:
[Export("numberOfRowsInTableView:")]
public int GetRowCount(NSTableView aTableView)
{
return records.Count;// records is an ArrayList
}
[Export("tableView:objectValueForTableColumn:row:")]
public NSObject GetObjectValue(NSTableView aTableView,
NSTableColumn aTableColumn, int rowIndex)
{
string identifier = aTableColumn.Identifier.ToString();
Object theRecord, theValue;
theRecord = records[rowIndex];
theValue = ((Hashtable)theRecord)[identifier];
return (NSObject)theValue;// this cast is not working
}
Running the program crashes when I try to add data to the TableView.
Using the debugger seems to indicate that all is well up to the 'return'
in GetObjectValue when the cast fails with "Unhandled Exception:
System.InvalidCastException: Cannot cast from source to destination
type". Is this the correct way to do this cast?
Thanks
Gareth Baker
--
Scanned by iCritical.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20100820/941c3b5a/attachment.html
More information about the Mono-osx
mailing list