changeset 1791:ed8851658015

Set status text fields in the test program to auto height... because they were too small on Mac.... this caused me to notice a bug in the calculation of (status) text widgets when the text is empty; this also contains a fix for that bug.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 05 Aug 2012 13:02:39 +0000
parents 209c57a14b09
children b0bdec1b820c
files dwtest.c mac/dw.m
diffstat 2 files changed, 19 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dwtest.c	Sat Aug 04 07:35:13 2012 +0000
+++ b/dwtest.c	Sun Aug 05 13:02:39 2012 +0000
@@ -1008,9 +1008,9 @@
     hbox = dw_box_new(DW_HORZ, 1 );
     dw_box_pack_start( notebookbox2, hbox, 100, 20, TRUE, FALSE, 1);
     status1 = dw_status_text_new("", 0);
-    dw_box_pack_start( hbox, status1, 100, 20, TRUE, FALSE, 1);
+    dw_box_pack_start( hbox, status1, 100, -1, TRUE, FALSE, 1);
     status2 = dw_status_text_new("", 0);
-    dw_box_pack_start( hbox, status2, 100, 20, TRUE, FALSE, 1);
+    dw_box_pack_start( hbox, status2, 100, -1, TRUE, FALSE, 1);
     /* a box with combobox and button */
     hbox = dw_box_new(DW_HORZ, 1 );
     dw_box_pack_start( notebookbox2, hbox, 100, 25, TRUE, FALSE, 1);
@@ -1134,7 +1134,7 @@
 
     /* and a status area to see whats going on */
     tree_status = dw_status_text_new("", 0);
-    dw_box_pack_start( notebookbox3, tree_status, 100, 20, TRUE, FALSE, 1);
+    dw_box_pack_start( notebookbox3, tree_status, 100, -1, TRUE, FALSE, 1);
 
     /* set up our signal trappers... */
     dw_signal_connect(tree, DW_SIGNAL_ITEM_CONTEXT, DW_SIGNAL_FUNC(item_context_cb), DW_POINTER(tree_status));
@@ -1175,7 +1175,7 @@
 
     /* and a status area to see whats going on */
     container_status = dw_status_text_new("", 0);
-    dw_box_pack_start( notebookbox4, container_status, 100, 20, TRUE, FALSE, 1);
+    dw_box_pack_start( notebookbox4, container_status, 100, -1, TRUE, FALSE, 1);
 
     titles[0] = "Type";
     titles[1] = "Size";
--- a/mac/dw.m	Sat Aug 04 07:35:13 2012 +0000
+++ b/mac/dw.m	Sun Aug 05 13:02:39 2012 +0000
@@ -3694,19 +3694,26 @@
         }
     }
     /* If the control is an entryfield set width to 150 */
-    else if([object isKindOfClass:[ NSTextField class ]] && [object isEditable])
+    else if([object isKindOfClass:[ NSTextField class ]])
     {
         NSFont *font = [object font];
-        /* Spinbuttons don't need to be as wide */
-        if([object isMemberOfClass:[ DWSpinButton class]])
-            thiswidth = 50;
+        
+        if([object isEditable])
+        {
+            /* Spinbuttons don't need to be as wide */
+            if([object isMemberOfClass:[ DWSpinButton class]])
+                thiswidth = 50;
+            else
+                thiswidth = 150;
+            /* Spinbuttons don't need to be as wide */
+            if([object isMemberOfClass:[ DWComboBox class]])
+                extraheight = 4;
+        }
         else
-            thiswidth = 150;
+            nsstr = [object stringValue];
+        
         if(font)
             thisheight = (int)[font boundingRectForFont].size.height;
-        /* Spinbuttons don't need to be as wide */
-        if([object isMemberOfClass:[ DWComboBox class]])
-            extraheight = 4;
     }
     /* Handle the ranged widgets */
     else if([ object isMemberOfClass:[DWPercent class] ] ||