#238 ✓resolved
Moritz Angermann

Make CPTextFields setPlaceholderString resettable

Reported by Moritz Angermann | March 7th, 2009 @ 01:09 AM

The way it is now, prevents one to change the placeholder text later on. (The first set placeholder text stays and is not updated).

var tf = [[CPTextField alloc] initWithFrame:CGMakeRectZero()]; [tf setPlaceholderString:@"No value"]; [tf setPlaceholderString:@"No selection"];

will display "No Value" instead of "No selection".

Proposed change below for CPTextField.j

-(void)setPlaceholderString:(CPString)aStringValue {

if(_placeholderString && [self stringValue] === _placeholderString)
    _value = @""; // or nil. or a flag.
_placeholderString = aStringValue;

//if there is no set value, automatically display the placeholder
if (!_value) 
    [self setStringValue:_placeholderString];

}

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages