changeset 2700:246f23670e3b

iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get(). The checkbox code is a recent breakage, from a method conflict. The MLE word wrap code isn't pretty, not sure this is the best way... but it works, so using it for the time being.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 16 Nov 2021 11:26:19 +0000
parents 0d5e99279c8b
children 9df2c11f020f
files ios/dw.m
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Mon Nov 15 21:12:32 2021 +0000
+++ b/ios/dw.m	Tue Nov 16 11:26:19 2021 +0000
@@ -3193,6 +3193,13 @@
                     DWSplitBar *split = (DWSplitBar *)handle;
                     [split resize];
                 }
+                else if([handle isMemberOfClass:[DWMLE class]])
+                {
+                    DWMLE *mle = (DWMLE *)handle;
+
+                    if([[mle textContainer] lineBreakMode] == NSLineBreakByClipping)
+                        [[mle textContainer] setSize:CGRectInfinite.size];
+                }
 
                 /* Advance the current position in the box */
                 if(thisbox->type == DW_HORZ)
@@ -4662,7 +4669,7 @@
     DWButton *button = handle;
     int retval = FALSE;
 
-    if([button state])
+    if([button checkState])
         retval = TRUE;
     DW_FUNCTION_RETURN_THIS(retval);
 }
@@ -5343,10 +5350,16 @@
 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int)
 {
     DWMLE *mle = handle;
-    NSUInteger mask = state ? 0 :UIViewAutoresizingFlexibleWidth;
-    
-    [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|mask];
+
     [[mle textContainer] setLineBreakMode:(state ? NSLineBreakByWordWrapping : NSLineBreakByClipping)];
+    [[mle textContainer] setWidthTracksTextView:(state ? YES : NO)];
+    if(!state)
+        [[mle textContainer] setSize:CGRectInfinite.size];
+    else
+    {
+        CGSize size = [mle frame].size;
+        [[mle textContainer] setSize:CGSizeMake(size.width, CGRectInfinite.size.height)];
+    }
     DW_FUNCTION_RETURN_NOTHING;
 }