Permalink
Browse files

Handle resizing of the Twitter panel.

  • Loading branch information...
1 parent 3c19f03 commit 85f2620991be0f7fbba2903f141b01e13b4ca222 @hlship committed Sep 8, 2009
Showing with 15 additions and 3 deletions.
  1. +15 −3 src/main/webapp/app/TwitterController.j
@@ -2,11 +2,13 @@
@import <AppKit/CPPanel.j>
@import <AppKit/CPTextField.j>
@import <AppKit/CPColor.j>
+@import <AppKit/CPScrollView.j>
@implementation TwitterController : CPObject
{
CPPanel _panel;
CPTextField _field;
+ CPView _scrollViewContent;
}
- (id)init
@@ -19,21 +21,31 @@
styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
[_panel setTitle:@"Twitter"];
-
+ [_panel setMinSize:CGSizeMake(245, 184)];
var label = [CPTextField labelWithTitle:"User:"];
- [[label setFrame:CGRectMake(3, 7, 50, 24)] sizeToFit];
+ [label setFrame:CGRectMake(3, 7, 50, 24)];
[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:)];
+ [_field setAutoresizingMask:CPViewWidthSizable];
+
+ var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 32, 245, 160)];
+
+ [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
+
+ [scrollView setAutohidesScrollers:YES];
+ [scrollView setBackgroundColor:[CPColor whiteColor]];
var content = [_panel contentView];
+
[content addSubview:label];
[content addSubview:_field];
+ [content addSubview:scrollView];
}
return self;
@@ -47,7 +59,7 @@
- (void)startSearch:(id)sender
{
- window.alert("startSearch:");
+
}
@end

0 comments on commit 85f2620

Please sign in to comment.