- (id) initWithTitle:(NSString *)title buttons:(NSArray *)buttons defaultButtonIndex:(int)index {
if ((self = [super init])) {
- (id) initWithTitle:(NSString *)title buttons:(NSArray *)buttons defaultButtonIndex:(int)index {
if ((self = [super init])) {
[self setDelegate:self];
for (NSString *button in buttons) [self addButtonWithTitle:button];
[self setCancelButtonIndex:index];
[self setDelegate:self];
for (NSString *button in buttons) [self addButtonWithTitle:button];
[self setCancelButtonIndex:index];
NSRunLoop *loop([NSRunLoop currentRunLoop]);
NSDate *future([NSDate distantFuture]);
while (button_ == 0 && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
NSRunLoop *loop([NSRunLoop currentRunLoop]);
NSDate *future([NSDate distantFuture]);
while (button_ == 0 && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);