bugGNU Octave - Bugs: bug #58261, Matlab uses [1 1 1] for...

 
 

bug #58261: Matlab uses [1 1 1] for backgroundcolor of uicontrol Edit objects

Submitter:  Rik <rik5>
Submitted:  Mon 27 Apr 2020 04:17:22 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  rik5
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 28 Apr 2020 10:28:38 PM UTC, comment #8: 

Thanks for testing.  The behavior is so inconsistent that I'm just going to leave Octave as is.  The gray color is pretty nice anyways.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Tue 28 Apr 2020 10:11:50 PM UTC, comment #7: 

Matlab's behavior is just odd here so I can see both arguments.

For a popupmenu, see the attached file. With default color, the 'main' menu is in gray while its 'content' is in white. If one changes the backgrouncolor to anything else, all 'menus' use that color.


Guillaume <gyom>
Mon 27 Apr 2020 08:43:56 PM UTC, comment #6: 

I think the decision makes sense from a user design perspective.  It generally is nice to have high contrast (black lettering on white background) when reading text.  So it is probably okay to make this small change just for text and listbox objects (and maybe popupmenu).

Rik <rik5>
Group administrator
Mon 27 Apr 2020 07:47:40 PM UTC, comment #5: 

@Rik: Note that this Matlab behavior can be qualified a bug in the sense that they don't do what they say they should be doing.
Are we trying to introduce this bug just for compatibility or is it a sensible choice for e.g. ui design?

What about introducing (background)colormode properties ? Something like :

  • "auto": use Qt's defaul value
  • "manual": use (background)color property


This would allow us for properly documenting this behavior, and allow the user to benefit Qt's theming capabilities.

PS: I wouldn't be surprised if ML actually had (background)colormode hidden properties.

Pantxo Diribarne <pantxo>
Group Member
Mon 27 Apr 2020 07:16:49 PM UTC, comment #4: 

Actually, a simpler example is attached as tst_popup2.m.

(file #48958)

Rik <rik5>
Group administrator
Mon 27 Apr 2020 05:20:44 PM UTC, comment #3: 

I checked in a change for edit/listbox objects here: https://hg.savannah.gnu.org/hgweb/octave/rev/be19ade4acc3.

What about "popupmenu"?  I'm attaching a function for testing.  Call it with "tst_popup"

(file #48957)

Rik <rik5>
Group administrator
Mon 27 Apr 2020 05:09:51 PM UTC, comment #2: 

I used your script after replacing "Edit" with "Listbox" and I observe the same thing: when displaying the list box with the default value for the background color, it is actually displayed in white.

Guillaume <gyom>
Mon 27 Apr 2020 04:22:28 PM UTC, comment #1: 

@gyom: Can you test in Matlab if there is any other uicontrol object which has this special background quirk of using white instead of the gray value specified in "backgroundcolor"?

In Octave, the code that will be modified to make a special exception is


if (props.style_is ("edit")
    || props.style_is ("listbox"))
  {
    p.setColor (QPalette::Active, QPalette::Base,
                Utils::fromRgb (props.get_backgroundcolor_rgb ()));
    p.setColor (QPalette::Inactive, QPalette::Base,
                Utils::fromRgb (props.get_backgroundcolor_rgb ()));
    p.setColor (QPalette::Active, QPalette::Text,
                Utils::fromRgb (props.get_foregroundcolor_rgb ()));
    p.setColor (QPalette::Inactive, QPalette::Text,
                Utils::fromRgb (props.get_foregroundcolor_rgb ()));
  }


If "listbox" doesn't also use a white background then I will need to split the code up and add another elseif branch.  Also, if there are any other style types which use white then I need to add them to the if branch here.


Rik <rik5>
Group administrator
Mon 27 Apr 2020 04:17:22 PM UTC, original submission:  

Despite the documentation, that backgroundcolor is [0.94, 0.94, 0.94], Matlab uses [1 1 1] (pure white).  Howver, if the backgroundcolor property is changed then Matlab does update the color correctly.

A test script is attached.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48963:  uicontrol_popup.png added by gyom (14KiB - image/png)
file #48958:  tst_popup2.m added by rik5 (141B - text/x-matlab)
file #48957:  tst_popup.m added by rik5 (384B - text/x-matlab)
file #48956:  tst_edit_bg.m added by rik5 (795B - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-04-28 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2020-04-28 gyom Attached File- Added uicontrol_popup.png, #48963
    2020-04-27 rik5 Attached File- Added tst_popup2.m, #48958
    2020-04-27 rik5 Attached File- Added tst_popup.m, #48957
    2020-04-27 rik5 StatusConfirmed In Progress
    2020-04-27 rik5 Assigned toNone rik5
    2020-04-27 rik5 Attached File- Added tst_edit_bg.m, #48956
        Carbon-Copy- Added gyom

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code