bugGNU Octave - Bugs: bug #48255, Default settings with uicontrols

 
 

bug #48255: Default settings with uicontrols

Submitter:  Guillaume <gyom>
Submitted:  Fri 17 Jun 2016 10:31:04 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  lostbard
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
   

Jump to the original submission

Fri 14 Oct 2016 10:58:24 AM UTC, comment #7: 

I assume the difference in colors between Octave and Matlab is a feature and not a bug, and users can always be explicit for the color, backgroundcolor and foregroundcolor properties to make sure display is identical.
Given you fixed the issue with the value property, this report can be closed as fixed.

Guillaume <gyom>
Thu 13 Oct 2016 07:58:28 PM UTC, comment #6: 

The default colors for uicontrols are set in _init_qt_.cc, and pulls the Qt system colors so will change based on whatever colors have been set for the current the theme in QT.

The default figure color doesn't look to be.

John Donoghue <lostbard>
Group Member
Thu 13 Oct 2016 12:05:38 PM UTC, comment #5: 
John Donoghue <lostbard>
Group Member
Thu 13 Oct 2016 09:28:18 AM UTC, comment #4: 

The patch works for me, thanks!

The last issue mentioned here relates to the default color values: I guess it's a "won't fix".

Guillaume <gyom>
Wed 12 Oct 2016 07:40:51 PM UTC, comment #3: 

This works for me

default value now 0, set explccit set to value to 1 for listbox and popupmenu if a valid value wasn't provided



(file #38714)

John Donoghue <lostbard>
Group Member
Wed 12 Oct 2016 05:12:05 PM UTC, comment #2: 

looking at the code, it sets all uicontrols 'value' property to 1.0

Many of the controls don't care on its value for display so don't look wrong


Looking at matlab, using the  example below and the running

get(u, 'value'), it looks like most control (except listbox and popupmenu) default to value 0.

So it may make sense to set the default value parameter to 0, and handle the 2 special cases.


John Donoghue <lostbard>
Group Member
Wed 12 Oct 2016 09:49:21 AM UTC, comment #1: 

The setting of foreground and background colors has been fixed in bug #49247.
What remains is the default setting for the 'value' property (especially for checkbox and radiobutton).

Guillaume <gyom>
Fri 17 Jun 2016 10:31:04 AM UTC, original submission:  

Octave and Matlab differ in default settings for the backgroundcolor, foregroundcolor and value properties of uicontrols. Here is what Matlab does and a file is attached of a screenshot illustrating the differences:


>> F = figure;
set(0,'defaultuicontrolunits','normalized') ;
u(1) = uicontrol(F,'Style','checkbox', 'String','string', 'Position',[0.3 0.8 0.4 0.09]);
u(2) = uicontrol(F,'Style','edit', 'String','string', 'Position',[0.3 0.7 0.4 0.09]);
u(3) = uicontrol(F,'Style','listbox', 'String','string', 'Position',[0.3 0.6 0.4 0.09]);
u(4) = uicontrol(F,'Style','popupmenu', 'String','string', 'Position',[0.3 0.5 0.4 0.09]);
u(5) = uicontrol(F,'Style','pushbutton', 'String','string', 'Position',[0.3 0.4 0.4 0.09]);
u(6) = uicontrol(F,'Style','radiobutton', 'String','string', 'Position',[0.3 0.3 0.4 0.09]);
u(7) = uicontrol(F,'Style','text', 'String','string', 'Position',[0.3 0.2 0.4 0.09]);
u(8) = uicontrol(F,'Style','togglebutton', 'String','string', 'Position',[0.3 0.1 0.4 0.09]);
>> get(F,'color')

ans =

    0.9400    0.9400    0.9400

>> cell2mat(get(u,'backgroundcolor'))

ans =

    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400
    0.9400    0.9400    0.9400

>> cell2mat(get(u,'foregroundcolor'))

ans =

     0     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0

>> cell2mat(get(u,'value'))

ans =

     0
     0
     1
     1
     0
     0
     0
     0


In Octave, backgroundcolor is set to [0.83922   0.82353   0.81569], foregroundcolor is set to [0.13333   0.12157   0.11765] and value is always 1. Default color for a figure is [1 1 1].

My take on this is:

  • while it might not be necessary that Octave and Matlab have the same default values for colors, it would be great if figure's color and uicontrol's backgroundcolor match.
  • default setting for the value property in uicontrols should match Matlab's.
  • there is an issue with checkbox, popupmenu and radiobutton uicontrols where it is impossible to change the backgroundcolor property (try with set(u,'backgroundcolor',[1 0 0]) )
  • there seems to be an issue with a popupmenu uicontrol where it is impossible to change the foregroundcolor property (try with set(u,'foregroundcolor',[0 1 0]) )
Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38714:  defvalue.patch added by lostbard (2KiB - application/octet-stream)
file #37512:  uicontrols.png added by gyom (32KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-14 lostbard StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2016-10-12 lostbard Attached File- Added defvalue.patch, #38714
        StatusNone Patch Submitted
        Assigned toNone lostbard
    2016-06-17 gyom Attached File- Added uicontrols.png, #37512

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code