octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57449] struct2hdl fails to set property with


From: anonymous
Subject: [Octave-bug-tracker] [bug #57449] struct2hdl fails to set property with erroneous "invalid value"
Date: Thu, 19 Dec 2019 08:55:32 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0

URL:
  <https://savannah.gnu.org/bugs/?57449>

                 Summary: struct2hdl fails to set property with erroneous
"invalid value"
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 19 Dec 2019 01:55:31 PM UTC
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

When I try to open a .fig-file which contains some ui element that has, for
some reason, an invalid value in some property, then I can open the figure but
the ui element isn't there at all. 

Some background on this: I created a GUI in Matlab via GUIDE. I implemented
simple text fields and set the fontweight to "demi" - since this property is
known both in Octave and Matlab. I then call openfig() on the .fig-file in
Octave, but in struct2hdl it fails to set the fontweight to "demi":

error: invalid value = demi
error: called from
    struct2hdl>setprops at line 630 column 12
    struct2hdl at line 196 column 3
    struct2hdl at line 190 column 15
    hgload at line 98 column 10
    openfig at line 113 column 8


I don't know what the underlying issue is, but I observed this behaviour for
text->fontweight: demi and uipanel->title, even though both of these
properties / values are known to Octave. (I therefore assigned this bug as a
Matlab compatibility issue, but please correct me if I'm wrong)

The current output is no ui element at all if it contained an invalid value,
no matter at which property fails in set(). As an alternative, I'd like to see
the ui element but maybe with a default value for this property. 
Currently, the code in the subfunction setprops() starting at line 627 looks
like: 

nh = length (hdls);
msg = "";
 if (! nh)
   set (h, s.properties);
 else
...


I'd propose a nested try-catch-block in the if(!nh) - case. My current
workaround looks like this: 

try
 set (h, s.properties);
catch
 temp = fieldnames(s.properties);
 for ind = 1:length(temp)
   try 
    set (h,temp{ind}, s.properties.([temp{ind}]));
   catch
    warning(['struct2hdl: failed to set the following property: ', temp{ind},'
of ', s.properties.tag,' , restored to default value']);
   end
 end
end 

This way I can see which property of which element failed while I can still
interact with my element, since every property has a default value. 

Since the issues with opening a Matlab-created .fig-file in Octave are
discussed elsewhere, I'd link bug #44670. 





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57449>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]