PDA

View Full Version : Subclassing NSTextField




ruhi
Aug 4, 2009, 08:05 AM
Hello,

I have made a subclass of NSTextField and trapped all keyup events on the textfield that my nib file has.

Problem is when i try to set any text into the text field in one of the button click event.

-(IBAction)setData: (id)sender
{
[mytextField setStringValue:str];
}

i cannot see any string in my textfield. Why is this so? :confused::confused:

Thanks,
Ruhi.



ritsard
Aug 10, 2009, 01:54 PM
Hello,

I have made a subclass of NSTextField and trapped all keyup events on the textfield that my nib file has.

Problem is when i try to set any text into the text field in one of the button click event.

-(IBAction)setData: (id)sender
{
[mytextField setStringValue:str];
}

i cannot see any string in my textfield. Why is this so? :confused::confused:

Thanks,
Ruhi.

so you're using the keyEvent to check for key strokes? What are you trying to achieve? What button do you click and why do you do it that way?

SRossi
Aug 10, 2009, 01:59 PM
I've had a look on google for you and people are saying that you need to update your view after changing the values. Try this and see.

Stephen

ruhi
Aug 11, 2009, 12:25 AM
Thanks for the concern.

But i got the solution now.

I just have to write [self setStringValue:@"test"] after setting the class of textfield as my class which is subclass of NSTextField.

Thanks,
ruhi.