[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Generalise set-routine in struct2hdl.m
From: |
Jasmin Zimmer |
Subject: |
Generalise set-routine in struct2hdl.m |
Date: |
Mon, 6 Jan 2020 08:30:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
Hello,
I've noticed an odd behaviour in Octave: when I try to open a .fig-file
(openfig() ) that contains UI elements, and one of these elements has an
invalid value for a property, this element doesn't show up on the user
interface. First I suspected this to be a bug but found out that Octave
actually follows MATLAB behaviour in this case. An element only gets
rendered if all of its properties contain valid values.
The source of this behaviour lies in stuct2hdl.m in the subfunction
setprops(), where all properties are handed over to set() in a single line.
I'd propose to generalise this behaviour for the following reasons:
- if the UI element doesn't show up at all, the user has no way of
interacting with the element and fixing whatever was wrong with it; the
only way out would be to manually put that element back into the figure
via command line, which is just not a good workaround
- it's pretty easy to set an invalid value for some property in Octave
by accident, especially since the next release / the current dev is
supposed to be able to open MATLAB-generated .fig-files; there are
deprecated properties in different MATLAB versions which you might not
be fully aware of - for example I originally stumbled upon this
behaviour because I set a text fontweight to "demi" in MATLAB R2010a,
which is now deprecated in the Octave dev
- even if one property contains an invalid value, there are still
default values for every property of the UI element; in fact, when I
generate a .fig-file in MATLAB and only modify a couple of properties,
only those which are different from the default values are handed over
in the set()-command in setprops(); thus it would be easiest to change
the invalid value to the default value, load the element and notify the user
Personally I've used a try-catch-block in struct2hdl.m which I've posted
in my original bug report at https://savannah.gnu.org/bugs/?57449.
Please let me know what you think about this proposal.
Best Regards,
Jasmin Zimmer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Generalise set-routine in struct2hdl.m,
Jasmin Zimmer <=