Permalink
Browse files

Implemented label and text field

  • Loading branch information...
1 parent 804cc0b commit 3c19f037b92767b9fb57dc99f854e940ad7f3d99 @hlship committed Sep 8, 2009
Showing with 26 additions and 2 deletions.
  1. +26 −2 src/main/webapp/app/TwitterController.j
@@ -1,9 +1,12 @@
@import <Foundation/CPObject.j>
@import <AppKit/CPPanel.j>
+@import <AppKit/CPTextField.j>
+@import <AppKit/CPColor.j>
@implementation TwitterController : CPObject
{
CPPanel _panel;
+ CPTextField _field;
}
- (id)init
@@ -12,10 +15,25 @@
if (self)
{
- _panel = [[CPPanel alloc] initWithContentRect:CGRectMake(20, 30, 184, 184)
+ _panel = [[CPPanel alloc] initWithContentRect:CGRectMake(20, 30, 245, 184)
styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
- [_panel setTitle:@"Twitter"];
+ [_panel setTitle:@"Twitter"];
+
+
+ var label = [CPTextField labelWithTitle:"User:"];
+ [[label setFrame:CGRectMake(3, 7, 50, 24)] sizeToFit];
+ [label setTextColor:[CPColor whiteColor]];
+
+ _field = [CPTextField textFieldWithStringValue:"" placeholder:"Twitter User" width:200];
+
+ [_field setFrame:CGRectMake(40, 0, 200, 28)];
+ [_field setTarget:self];
+ [_field setAction:@selector(startSearch:)];
+
+ var content = [_panel contentView];
+ [content addSubview:label];
+ [content addSubview:_field];
}
return self;
@@ -24,6 +42,12 @@
- (void)show
{
[_panel orderFront:self];
+ [_field becomeFirstResponder];
+}
+
+- (void)startSearch:(id)sender
+{
+ window.alert("startSearch:");
}
@end

0 comments on commit 3c19f03

Please sign in to comment.