Skip to content

Instantly share code, notes, and snippets.

@nickjs
Created October 8, 2008 20:23
Show Gist options
  • Save nickjs/15574 to your computer and use it in GitHub Desktop.
Save nickjs/15574 to your computer and use it in GitHub Desktop.
function LEAlert(string)
{
var alertWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0,0,300,150) styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask];
[alertWindow center];
[alertWindow setTitle:LEL.alertWindowTitle];
var content = [alertWindow contentView];
var text = [LELabel labelWithStringValue:string];
[text setTextColor:[CPColor whiteColor]];
[text setFont:[CPFont systemFontOfSize:16.0]];
[text setAlignment:CPCenterTextAlignment];
[text setLineBreakMode:CPLineBreakByWordWrapping];
[text setFrame:CGRectMake(10,0,CGRectGetWidth([content bounds])-20,80)];
var ok = [[CPButton alloc] initWithFrame:CGRectMake(CGRectGetWidth([content bounds])-60,CGRectGetHeight([content bounds])-30,50,20)];
[ok setBezelStyle:CPHUDBezelStyle];
[ok setTitle:LEL.ok];
[ok setTarget:alertWindow];
[ok setAction:@selector(performClose:)];
[content addSubview:text];
[content addSubview:ok];
[alertWindow orderFront:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment