# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1618436121 0 # Node ID 4fba0b9453eea293ea7ee0057316140baa98e5a5 # Parent 79c7bf492bc1f7723c09e17360b727acac6e096b iOS: Fix calculating label size when there is no text. Use "gT" to calculate the height. Fix some menu tests, they were using old classes or disabled code. diff -r 79c7bf492bc1 -r 4fba0b9453ee ios/dw.m --- a/ios/dw.m Wed Apr 14 20:53:46 2021 +0000 +++ b/ios/dw.m Wed Apr 14 21:35:21 2021 +0000 @@ -2111,6 +2111,7 @@ config = [UIContextMenuConfiguration configurationWithIdentifier:@"DWContextMenu" previewProvider:nil actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; + [window setPopupMenu:nil]; } return config; } @@ -3722,11 +3723,12 @@ /* If we have a string... * calculate the size with the current font. */ - if(nsstr && [nsstr length]) + if(nsstr) { int textwidth, textheight; - dw_font_text_extents_get(object, NULL, (char *)[nsstr UTF8String], &textwidth, &textheight); + /* If we have an empty string, use "gT" to get the most height for the font */ + dw_font_text_extents_get(object, NULL, [nsstr length] ? (char *)[nsstr UTF8String] : "gT", &textwidth, &textheight); if(textheight > thisheight) thisheight = textheight; @@ -8566,7 +8568,7 @@ NSArray *subviews = [sv subviews]; object = [subviews firstObject]; } - if([object isKindOfClass:[UIControl class]] || [object isKindOfClass:[UIMenuItem class]]) + if([object isKindOfClass:[UIControl class]] || [object isMemberOfClass:[DWMenuItem class]]) { [object setEnabled:NO]; } @@ -8598,7 +8600,7 @@ NSArray *subviews = [sv subviews]; object = [subviews firstObject]; } - if([object isKindOfClass:[UIControl class]] /* TODO: || [object isKindOfClass:[UIMenuItem class]] */) + if([object isKindOfClass:[UIControl class]] || [object isMemberOfClass:[DWMenuItem class]]) { [object setEnabled:YES]; }