bugGNU Octave - Bugs: bug #44700, Changing the style of a uicontrol...

 
 

bug #44700: Changing the style of a uicontrol after creation

Submitter:  Guillaume <gyom>
Submitted:  Thu 02 Apr 2015 02:40:39 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 15 Aug 2018 04:21:41 AM UTC, comment #3: 

I agree.  There doesn't seem to be a reason to prevent changing the "style" property of a uicontrol object.  I simply removed the check, as you suggested, and then tested changing the style to all different possibilities and saw no problems.  I checked in a changeset on the development branch here (https://hg.savannah.gnu.org/hgweb/octave/rev/df27088c307f).

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 27 Jul 2018 04:44:08 PM UTC, comment #2: 

Looking at this again, it seems to actually work fine, if one just comments out the call to error in libinterp/corefcn/graphics.cc:


void
uicontrol::properties::set_style (const octave_value& st)
{
  if (! get___object__ ().isempty ())
    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));
    }
}


The code below then works as expected, as well as with other styles of uicontrols. I understand there might be styles that require changes to the properties if they are swapped (?) but I can't think of any problem between 'text' and 'edit': could the error call be removed, either entirely or at least when it's a change between "text" and "edit"?

Guillaume <gyom>
Fri 23 Dec 2016 10:13:34 PM UTC, comment #1: 

This feature is still missing in Octave 4.2.0.

Hartmut <hardy>
Thu 02 Apr 2015 02:40:39 PM UTC, original submission:  

In MATLAB, it is possible th change the style of a uicontrol:


F=figure;
H=uicontrol(F,'Style','edit','String','content');
set(H,'Style','text');


while Octave returns an error stating it is not possible:


error: set: cannot change the style of a uicontrol object after creation.


I assume that this is a documented feature in MATLAB as it is not said in the documentation that the 'Style' property can only be set once and for all.

Is this something that could possibly be doable in Octave or shall I make sure that my code never uses this functionality as it won't be implemented?

Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-15 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code