Permalink
Browse files

Demonstrate that pop up button test is using tags.

  • Loading branch information...
1 parent 4eba585 commit ca9b3a7dbfbb36972019207ec9dd0791e123bb00 @aljungberg aljungberg committed Mar 25, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 Tests/Manual/CPPopUpButtonTest/AppController.j
@@ -25,24 +25,27 @@
for (var i = 0; i < 5; i++)
{
- var menuItem1 = [[CPMenuItem alloc] initWithTitle:[CPString stringWithFormat:@"%i", i] action:nil keyEquivalent:nil];
+ var menuItem1 = [[CPMenuItem alloc] initWithTitle:[CPString stringWithFormat:@"Left %i", i] action:nil keyEquivalent:nil];
[menuItem1 setTag:i];
[popUpButton addItem:menuItem1];
- var menuItem2 = [[CPMenuItem alloc] initWithTitle:[CPString stringWithFormat:@"%i", i] action:nil keyEquivalent:nil];
+ var menuItem2 = [[CPMenuItem alloc] initWithTitle:[CPString stringWithFormat:@"Right %i", i] action:nil keyEquivalent:nil];
[menuItem2 setTag:i];
[popUpButton2 addItem:menuItem2];
}
[popUpButton sizeToFit];
[popUpButton2 sizeToFit];
+ var width = CGRectGetWidth([popUpButton frame]),
+ width2 = CGRectGetWidth([popUpButton2 frame]);
+
[popUpButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
- [popUpButton setCenter:CGPointMake([contentView center].x - 25.0, [contentView center].y)];
+ [popUpButton setCenter:CGPointMake([contentView center].x - width / 2.0 - 10, [contentView center].y)];
[contentView addSubview:popUpButton];
[popUpButton2 setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
- [popUpButton2 setCenter:CGPointMake([contentView center].x + 25.0, [contentView center].y)];
+ [popUpButton2 setCenter:CGPointMake([contentView center].x + width / 2.0 + 10, [contentView center].y)];
[contentView addSubview:popUpButton2];
var textField = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 200.0, 29.0)],

0 comments on commit ca9b3a7

Please sign in to comment.