bugGNU Octave - Bugs: bug #49751, Output of uicontrol

 
 

bug #49751: Output of uicontrol

Submitted by:  Guillaume <gyom>
Submitted on:  Fri 02 Dec 2016 12:58:41 PM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 13 Mar 2017 05:06:31 AM UTC, comment #4:

I just came across this patch in my e-mail. I applied it on the development branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/cc9dcadcef6b). Thanks Guillaume!

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Mon 05 Dec 2016 10:51:59 AM UTC, comment #3:

Thanks. I've checked all ui* functions and made adjustments when needed for better compatibility with Matlab.

There is one function I didn't change: uiwait. In Octave, as documented, the function returns immediately if there is no input and no current figure. In this context, Matlab creates a new figure (as described in its documentation).

https://www.mathworks.com/help/matlab/ref/uiwait.html

(file #39146)

Guillaume <gyom>
Fri 02 Dec 2016 05:26:30 PM UTC, comment #2:

No objections to making such a change. Take a look at how this is done for the scripts in the plot/draw directory. As just one example, here is waterfall.m:

The code uses 'htmp' rather than tmp so that it is clear that the underlying variable is a handle. Otherwise, 'tmp' might be an integer, a string, who knows?

In this case the function is so short one wouldn't become confused, but it is still good practice.

Also, in this case the documentation refers to the return value as 'hui' so the code should use that variable as well.

Does Matlab avoid returning the handle if there is no output argument for all uiXXX functions? If so, we should implement the--easy--change across all the uiXX functions in scripts/gui/.

Rik <rik5>
Project Administrator
Fri 02 Dec 2016 03:06:11 PM UTC, comment #1:

Since uicontrol will never return more than one argument, varargout is not useful, the second (H=htmp) is thus more clear.

Pantxo Diribarne <pantxo>
Project Member
Fri 02 Dec 2016 12:58:41 PM UTC, original submission:

This is a small suggestion to have uicontrol only return a handle when explicitly requested, in alignment with Matlab's behavior.

I used the same mechanism as in uimenu but I wonder what is the recommended way to proceed:

instead of:

Guillaume <gyom>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #39146:  patch_ui.diff added by gyom (6KiB - application/x-download)
file #39132:  fix_uicontrol.diff added by gyom (480B - application/x-download)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 13 Mar 2017 05:06:31 AM UTCrik5StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Mon 05 Dec 2016 10:51:59 AM UTCgyomAttached File-=>Added patch_ui.diff, #39146
    Fri 02 Dec 2016 05:26:30 PM UTCrik5Severity3 - Normal=>2 - Minor
      StatusNone=>In Progress
    Fri 02 Dec 2016 12:58:41 PM UTCgyomAttached File-=>Added fix_uicontrol.diff, #39132

    Back to the top


    Powered by Savane 3.1-cleanup1