Created
January 14, 2009 10:03
-
-
Save anonymous/46857 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @implementation SearchToolbarItem : CPTextField | |
| { | |
| } | |
| - (id)initWithFrame:(CGRect)aFrame | |
| { | |
| self = [super initWithFrame:CGRectMake(0, CGRectGetHeight(aFrame)/2.0 - (22/2), CGRectGetWidth(aFrame)/2, 22)]; | |
| [self setPlaceholderString:"Search..."]; | |
| [self setAlignment:CPLeftTextAlignment]; | |
| [self setFont: [CPFont systemFontOfSize: 12.0]] | |
| [self setBordered:YES]; | |
| [self setBezeled:YES]; | |
| [self setBezelStyle:CPTextFieldRoundedBezel]; | |
| // [self setBezelStyle:CPTextFieldSquareBezel]; | |
| [self setEditable:YES]; | |
| [self setSelectable:YES]; | |
| [self setTarget:self]; | |
| [self setAction:@selector(returnPressed:)]; | |
| return self; | |
| } | |
| // If the user presses the Return key, notify the database view | |
| - (void)returnPressed:(id)sender | |
| { | |
| CPLogConsole("Object value: <"+[self objectValue]+">", "info"); | |
| CPLogConsole("String value: <"+[self stringValue]+">", "info"); | |
| [[CPNotificationCenter defaultCenter] postNotificationName:"loadDatabaseSearchedContent" object:[self objectValue]]; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment