changeset 26481:9f9aa7e92826 stable

Fix regression in uicontrol "style" property handling (bug #55368). * graphics.cc (uicontrol::properties::set_style): Fix the "value" property of popupmenu and listbox objects before notifying the toolkit of the style change
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 06 Jan 2019 22:10:44 +0100
parents 4203f6e0cd7d
children 7647b82f921b
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Sat Dec 29 09:23:11 2018 -0500
+++ b/libinterp/corefcn/graphics.cc	Sun Jan 06 22:10:44 2019 +0100
@@ -10482,14 +10482,20 @@
 void
 uicontrol::properties::set_style (const octave_value& st)
 {
-  style = st;
-
-  // if we know know what we are, can override value for listbox and popupmenu
-  if (style_is ("listbox") || style_is ("popupmenu"))
+  // Don't notify the style change until the "value" property is fixed
+  bool modified = style.set (st, true, false);
+
+  // We now need to override "value" for listbox and popupmenu and eventually
+  // notify the toolkit afterwards.
+  if (modified && (style_is ("listbox") || style_is ("popupmenu")))
     {
       Matrix v = value.get ().matrix_value ();
-      if (v.numel () == 1 && v (0) == 0)
-        value.set (octave_value (1));
+      if (v.numel () == 1 && v(0) == 0)
+        value.set (octave_value (1), true, false);
+
+      graphics_object go = gh_manager::get_object (get___myhandle__ ());
+      if (go)
+        go.update (style.get_id ());
     }
 }