help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formatting the cells in NSTableView


From: Alexander Malmberg
Subject: Re: Formatting the cells in NSTableView
Date: Sun, 25 Apr 2004 04:01:05 +0200

> Hello,
> 
> I am porting an application for designing and simulating rainwater 
> harvesting system 
> (http://homepage.mac.com/vsvyas/science.html#simtanka) from Visual 
> Basic to GNUstep.
> 
> I have a table in which the user enters monthly rainfall data using
> 
> - (void) tableView: (NSTableView *) view
>           setObjectValue: (id) object
>           forTableColumn: (NSTableColumn *) column
>           row: (int) row
> I  would like that user should be able to enter only positive numbers 
> in  monthly rainfall columns, and a year greater than 1900 in the year 
> column. Would appreciate any help on this.

One solution would be to validate the data in
-tableView:setObjectValue:... before actually changing the value, and
beeping or something if it isn't valid. If you want to do this checking
earlier, you'll probably want to implement control:textShouldEndEditing:
in the delegate, or use custom cell classes for the table columns and
override isEntryAcceptable:. You could also try setting a custom
NSFormatter for the column cells, but I'm not sure how well that'll work
currently.

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]