Problem editing columns in TableView
Problem editing columns in TableView
- Subject: Problem editing columns in TableView
- From: "Vidya Nair" <email@hidden>
- Date: Tue, 4 Feb 2003 21:00:15 +0530
Hi All,
I am facing a problem during editing cell in tableView.
The dataCell of the tablecolumns in this tableview are of a custom class
which is derived from NSTextFieldCell.
The maximum length of data allowed in different columns of the tableview
is different and what I want is as and when the user types any text into
the column it should be converted to uppercase and if the length exceeds
the maximum then the application should give a error sound and limit the
text to the allowed length.
The interface of the custom class My_Cell.h
@interface My_Cell : NSTextFieldCell
In My_Cell.m I have implemented the textDidChange notifiction as follows
- (void)textDidChange:(NSNotification *)aNotification
{
// Here maxSize is a variable which gives the Maxsize of that cell.
if([[[aNotification object] string] length] > maxSize)
{
NSBeep();
[[aNotification object] setString:[[[aNotification object] string]
substringToIndex:maxSize]];
}
[[aNotification object] setString:[[[aNotification object] string]
uppercaseString]];
}
Here the aNotification object i get is NSTextView.
But the problem I am facing is if the user edits a cell and writes some
text in between then the cursor is automatically placed at the end of the
text. This behaviour is unwanted.
What i have gathered is that setString method is causing this. Is there any
way in which I can implement the two features i.e. Checking of length and
converting the text entered into uppercase without the above mentioned
problems.
Any help or suggestion will be highly appreciated.
Hoping to get some help.
Thanks and Regards
Vidya
_______________________________________________
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.