changeset 22619:7adc5bbd840a stable

graphics: set uicontrol value default to 0 and handle special cases (Bug #48255) * libinterp/corefcn/graphics.in.h (uicontrol::properties): set uicontrol value to 0 * libinterp/corefcn/graphics.cc (uicontrol::properties::set_style): if listbox or popupmenu, set value to 1
author John D
date Thu, 13 Oct 2016 08:04:41 -0400
parents 51b7d8456ce3
children 37b7b86f62f2
files libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Wed Oct 12 18:22:41 2016 -0700
+++ b/libinterp/corefcn/graphics.cc	Thu Oct 13 08:04:41 2016 -0400
@@ -8809,6 +8809,14 @@
     error ("set: cannot change the style of a uicontrol object after creation.");
 
   style = st;
+
+  // if we know know what we are, can override value for listbox and popupmenu
+  if (style_is ("listbox") || style_is ("popupmenu"))
+    {
+      Matrix v = value.get ().matrix_value ();
+      if(v.numel () == 1 && v (0) == 0)
+        value.set (octave_value (1));
+    }
 }
 
 Matrix
--- a/libinterp/corefcn/graphics.in.h	Wed Oct 12 18:22:41 2016 -0700
+++ b/libinterp/corefcn/graphics.in.h	Thu Oct 13 08:04:41 2016 -0400
@@ -5517,7 +5517,7 @@
       radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu"
       string_property tooltipstring , ""
       radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters"
-      row_vector_property value , Matrix (1, 1, 1.0)
+      row_vector_property value , Matrix (1, 1, 0.0)
       radio_property verticalalignment , "top|{middle}|bottom"
     END_PROPERTIES