bugGNU Octave - Bugs: bug #49247, Backgroundcolor ignored for...


bug #49247: Backgroundcolor ignored for pushbutton and radiobutton

Submitter:  None
Submitted:  Sun 02 Oct 2016 12:27:10 PM UTC
Category:  GUI Severity:  2 - Minor
Priority:  3 - Low Item Group:  Regression
Status:  Fixed Assigned to:  lostbard
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Fri 31 Jan 2020 09:00:51 PM UTC, comment #29: 

As far as I can tell the original issue on this bug report has been solved, the background color property works on pushbuttons and radiobuttons with Octave 5.1 and 5.2, so closing as fixed.

A number of side issues may have been discussed here but it's not clear to me what the state of those are. If anyone is still affected by something that was discussed here, please open a new bug report about it, preferably after testing with a current version of Octave. Thanks!

Mike Miller <mtmiller>
Group Member
Tue 26 Feb 2019 12:56:37 AM UTC, comment #28: 

Are there more changes to be made for this open bug report?

Mike Miller <mtmiller>
Group Member
Tue 01 Jan 2019 03:49:15 PM UTC, comment #27: 

I pushed the changeset to the stable branch here:

In the meantime I managed to get the gtk2 style to work via qt5c (breaking the style selection in the Octave properties on the way).
It looks like gtk2 uses the border property to style the buttons. The border seems to cover the background color completely.
The attached patch sets a manual border for the pushbutton objects. But the result doesn't look very good. And it also makes all other styles look worse...

(file #45826)

Markus Mützel <mmuetzel>
Group administrator
Tue 01 Jan 2019 02:06:02 PM UTC, comment #26: 

My vote for pushing the changeset. Afterwards, we can concentrate on fixing the bug for gtk.

On my system (Ubuntu 18.04, GNOME 3.26), the styles "default" and "gtk2" behave identically, which also implies that the patch does not work for "default" for me. With your configuration, I would have expected that "gtk2" is already available for you and/or that the patch is not working for your "default" style.

Torsten Lilge <ttl>
Group Member
Tue 01 Jan 2019 01:30:27 PM UTC, comment #25: 

Should we push the latest changeset because it fixes the regression on Windows? We could still push a follow-up patch for gtk2 when it is ready.
Or do you think you are close to having a solution for the "gtk2" style as well?

Do you know if it is possible to add gtk2 to the available styles on my Ubuntu 18.10 with GNOME 3.30.1?

Markus Mützel <mmuetzel>
Group administrator
Sun 30 Dec 2018 05:43:03 PM UTC, comment #24: 

@Markus: Unfortunately, this does not work for the style "gtk2" (but for any other style available on my system). I have also made some tests with

background-image: linear-gradient(%1,%1);

but without success.

Torsten Lilge <ttl>
Group Member
Sat 29 Dec 2018 05:39:08 PM UTC, comment #23: 

The attached patch works for me with Qt styles "Fusion", "Windows" and "WindowsVista".

@Torsten: If I correctly understand the css, the change should remove any background image. Could you please try whether this works for you with "gtk2"? (I used Guillaume's test from comment #8.)

This is a regression in 5.0. Tagging appropriately.

(file #45770)

Markus Mützel <mmuetzel>
Group administrator
Sat 15 Dec 2018 12:20:44 PM UTC, comment #22: 

To make it easier to follow, I am reposting the (incomplete) patch from bug #53174 which uses stylesheets for setting the button background color here.

Also a link to stackoverflow with an answer that might help for the issue with gtk2:

(file #45673)

Markus Mützel <mmuetzel>
Group administrator
Fri 14 Dec 2018 02:00:42 PM UTC, comment #21: 

As a comparison point, I attach a screenshot of how the figure created with comment #8 is displayed with current Octave dev and Matlab R2018b on openSUSE 15.0.

One difference in behavior that I observe is that for checkbox and radiobutton uicontrols, their state is changed whenever one clicks anywhere within them with Matlab while one has to click on the text or the little square or circle with Octave.

Guillaume <gyom>
Thu 13 Dec 2018 09:27:46 PM UTC, comment #20: 

Reopened since the issue is still present on other platforms and requires a more general approach like using style sheets instead of setPalette (see discussion and first patches in bug #53174).

Torsten Lilge <ttl>
Group Member
Fri 14 Oct 2016 11:50:19 AM UTC, comment #19: 

I think that position of controls is purely a toolkit (Qt vs ??) difference that we probably don't have much control over.

I see the same for slider color, and it looks like it ignores colors set via the palette - any examples I have seen of sucessfullt changing the slider colors has been through stylesheets.

John Donoghue <lostbard>
Group Member
Fri 14 Oct 2016 10:40:34 AM UTC, comment #18: 

Thanks for looking into this. I also notice when resizing the window (with the mouse) that the black border sometimes becomes transparent...

I also wanted to add that the black borders can also be observed with uicontrol's slider:

F = figure;
set(0,'defaultuicontrolunits','normalized') ;
u = uicontrol(F,'Style','slider', 'Position',[0.1 0.4 0.8 0.2]);

it also makes me notice that the display of the slider differs fropm Matlab: In Matlab, you have < on the left and > on the right, while in Octave you have < on the left and <> on the right.

Guillaume <gyom>
Thu 13 Oct 2016 07:37:34 PM UTC, comment #17: 

For the black box, I didn't see anything that could be set to remove it.

For the listbox, the frame can be changed to something like a Panel which does get rid of the line (Which looks like is a StyledPanel)

However the popupmenu and edit control both only have options to either display the frame or don't display it.

Without any frame, it doesn't match a standard control.

It might be able to be done using stylesheets.

John Donoghue <lostbard>
Group Member
Thu 13 Oct 2016 10:27:46 AM UTC, comment #16: 

Closing as fixed then

John Donoghue <lostbard>
Group Member
Thu 13 Oct 2016 09:31:45 AM UTC, comment #15: 

The black borders on edit, listbox and popupmenu are reported in bug #44704 so maybe this bug report can be closed as "fixed" and conversation continued there. Thanks!

Guillaume <gyom>
Wed 12 Oct 2016 10:43:38 AM UTC, comment #14: 

Hi, I'm very impressed about the activities initiated by my error report. Cause I'm using only OCTAVE as an end-user (no source) I cannot contribute in testing but it seems to me that a future release will solve this problem so I stay on happy.
Thanks to all !

L.Billmann <lbeducation>
Wed 12 Oct 2016 10:08:53 AM UTC, comment #13: 

Ive noticed the borders on some of them as well - will look at that next

John Donoghue <lostbard>
Group Member
Wed 12 Oct 2016 09:46:10 AM UTC, comment #12: 

Thanks again, John. All foreground and background colors seem to work fine, see attachment. I would actually be curious to see how it displays on your computer and whether you also have the black borders.

Guillaume <gyom>
Wed 12 Oct 2016 01:21:50 AM UTC, comment #11: 
John Donoghue <lostbard>
Group Member
Tue 11 Oct 2016 05:04:08 PM UTC, comment #10: 

You're right, I observe the same thing for popupmenu.

Guillaume <gyom>
Tue 11 Oct 2016 04:18:28 PM UTC, comment #9: 

for popup menu, it looks like its the selected (non popup) part of the control that doesnt respect the color changes - inserting more items and popping it does use the colors.

I'll see if there is a way to make it use the colors when not 'popped' as well.

John Donoghue <lostbard>
Group Member
Tue 11 Oct 2016 09:58:44 AM UTC, comment #8: 

John, thanks! I can confirm that the backgroundcolors are now fine for pushbutton and radiobutton.

I also reran the script from bug #48255 to compare Octave and Matlab for all uicontrols:

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]);
set(u,'backgroundcolor',[1 0 0])
set(u,'foregroundcolor',[0 1 0])

and I can see four issues:

  • backgroundcolor of popupmenu
  • text color (ie foregroundcolor) of checkbox, popupmenu and radiobutton
  • checkbox and radiobutton default value
  • edit, listbox and popupmenu have a strange looking black border.

Guillaume <gyom>
Mon 10 Oct 2016 09:35:47 PM UTC, comment #7: 
John Donoghue <lostbard>
Group Member
Mon 10 Oct 2016 02:37:01 PM UTC, comment #6: 

I'll recheck add those changes as well  don't break the windows change and then push to stable

John Donoghue <lostbard>
Group Member
Mon 10 Oct 2016 02:28:36 PM UTC, comment #5: 

Ok - I see that on fedora too - at a quick glance it looks like radiobutton (and checkbox) colors are not handled the same as pushbutton and togglebutton (when they should be)

John Donoghue <lostbard>
Group Member
Mon 10 Oct 2016 12:10:27 PM UTC, comment #4: 

I also observe the issue under Linux (Octave 4.3.0+ on openSUSE 13.2) with the radiobutton, but it's fine with the pushbutton.

Guillaume <gyom>
Sun 09 Oct 2016 03:24:08 AM UTC, comment #3: 

There is a lot of discusion on changing colors of pushbuttons on the Qt website when using Windows.

It appears that the standard setPalette option used in linux does not work depending on the application style.

Leaving two options to fix

1. embed the background color in the style for the button (which may not work, or may cause issues with other styles are also set)

2. set the application style to 'Windows' instead of WindowsXp or WindowsVista.

The attached patch does the second option.

(file #38689)

John Donoghue <lostbard>
Group Member
Sat 08 Oct 2016 06:45:06 PM UTC, comment #2: 

Does the same thing in the octave 4.2rc2 under windows.

Works fine for me, in fedora.

John Donoghue <lostbard>
Group Member
Mon 03 Oct 2016 02:10:32 PM UTC, comment #1: 

See also bug #48255 and perhaps bug #44704.

Guillaume <gyom>
Sun 02 Oct 2016 12:27:10 PM UTC, original submission:  

Specifying backgroundcolor for pushbutton or radiobutton is ignored and simply gray is used. For pushbutton it seems to be a small box around the button with the backgroundcolor but not the button itself. Simple program example and result from OCTAVE and MATLAB is found in the attachement.



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

Attach Files:

Attached Files
file #45826:  bug49247_pushbutton_border.patch added by mmuetzel (889B - application/octet-stream)
file #45770:  bug53174_stylesheets_v3.patch added by mmuetzel (2KiB - application/octet-stream)
file #45673:  bug53174_stylesheets_v2.patch added by mmuetzel (1KiB - application/octet-stream)
file #45660:  uicontrols.png added by gyom (31KiB - image/png)
file #38709:  all_uicontrols.png added by gyom (19KiB - image/png)
file #38699:  uicontrol_matlab.png added by gyom (12KiB - image/png)
file #38700:  uicontrol_octave.png added by gyom (19KiB - image/png)
file #38693:  backgroundcolor.png added by gyom (10KiB - image/png)
file #38689:  stylefix.patch added by lostbard (1KiB - text/x-patch)
file #38641:  test_gui_backgroundcolor.m added by None (486B - text/plain)
file #38642:  result_OCTAVE.png added by None (11KiB - image/png)
file #38643:  result_MATLAB.png added by None (16KiB - image/png)


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by lbeducation (Posted a comment)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by None (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 25 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-31 mtmiller StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2019-02-26 mtmiller Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        Release5.0.1 5.1.0
    2019-01-24 mtmiller Release5.0.0 5.0.1
    2019-01-01 mmuetzel Attached File- Added bug49247_pushbutton_border.patch, #45826
    2018-12-29 mmuetzel Attached File- Added bug53174_stylesheets_v3.patch, #45770
        Item GroupMatlab Compatibility Regression
        Releasedev 5.0.0
    2018-12-15 mmuetzel Attached File- Added bug53174_stylesheets_v2.patch, #45673
        StatusFixed In Progress
    2018-12-14 gyom Attached File- Added uicontrols.png, #45660
    2018-12-13 ttl Dependencies- Depends on bugs #53174
    2018-12-13 ttl Open/ClosedClosed Open
        Release4.0.3 dev
        Operating SystemMicrosoft Windows Any
    2016-10-13 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2016-10-12 gyom Attached File- Added all_uicontrols.png, #38709
    2016-10-11 gyom Attached File- Added uicontrol_matlab.png, #38699
        Attached File- Added uicontrol_octave.png, #38700
    2016-10-10 lostbard StatusPatch Submitted Ready For Test
    2016-10-10 gyom Attached File- Added backgroundcolor.png, #38693
    2016-10-09 lostbard Attached File- Added stylefix.patch, #38689

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code