From e766a2c945dbd06831f0fee8a38235c2404abfc9 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sat, 21 Aug 2010 17:47:03 -0400 Subject: [PATCH] Fixed: if a CPAlert message was 3 lines or more and there was no informative text, the upper half of the CPAlert buttons would not react to clicks as the blank informative label partially covered them. --- AppKit/CPAlert.j | 2 ++ Tests/Manual/CPAlertTest/AppController.j | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/AppKit/CPAlert.j b/AppKit/CPAlert.j index a3e719d68..4ce109051 100644 --- a/AppKit/CPAlert.j +++ b/AppKit/CPAlert.j @@ -365,6 +365,8 @@ CPCriticalAlertStyle = 2; [_messageLabel setFrame:CGRectMake(inset.left, inset.top, textWidth, messageSize.height + sizeWithFontCorrection)]; [_informativeLabel setFrame:CGRectMake(inset.left, CGRectGetMaxY([_messageLabel frame]) + informativeOffset, textWidth, informativeSize.height + sizeWithFontCorrection)]; + // Don't let an empty informative label partially cover the buttons. + [_informativeLabel setHidden:!informationString]; var aRepresentativeButton = _buttons[0], buttonY = MAX(CGRectGetMaxY([_alertImageView frame]), CGRectGetMaxY(informationString ? [_informativeLabel frame] : [_messageLabel frame])) + buttonOffset; // the lower of the bottom of the text and the bottom of the icon. diff --git a/Tests/Manual/CPAlertTest/AppController.j b/Tests/Manual/CPAlertTest/AppController.j index 4467d2fcb..1b7ffe44c 100644 --- a/Tests/Manual/CPAlertTest/AppController.j +++ b/Tests/Manual/CPAlertTest/AppController.j @@ -25,7 +25,10 @@ "Theorise", "Cancel"], [@"Snakes. Why did it have to be snakes?", nil, - "Torch", "Cancel"] + "Torch", "Cancel"], + [@"Sometimes a message can be really long and just appear to go on and on. It could be a speech. It could be the television.", + nil, + "Off", "Cancel"] ]; messageIndex = 0; @@ -69,12 +72,11 @@ if (![variations count]) return; - var variation = variations[0], message = messages[messageIndex], alert = [[CPAlert alloc] init]; - messageIndex = 1 - messageIndex; + messageIndex = (messageIndex + 1) % messages.length; [variations removeObjectAtIndex:0]; [alert setDelegate:self];