Bug 110986 - Progressbar:setForegroundColor() does not work
Summary: Progressbar:setForegroundColor() does not work
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2017-08-01 12:53 UTC by Thomas Krumbein
Modified: 2018-08-07 02:32 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

example dialog (23.19 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-08-01 12:53 UTC, Thomas Krumbein
bt with debug symbols (20.46 KB, text/plain)
2017-08-01 22:22 UTC, Julien Nabet

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Krumbein 2017-08-01 12:53:55 UTC
Created attachment 135049 [details]
example dialog

Creating a Progressbar inside of a dialog the service com.sun.star.awt.UnoControlProgressBarModel export the Interface com.sun.star.awt.XProgressBar.

This interface has a public function setForegroundColor() which should define the progressbar foreground color.

But it does not work. 

After setting a foreground color and checking it with XRAY - it is still empty. 

When changing color during Process... no reaction.

You can call and start example Document and start progress-bar. should change color by reaching 80% ...

checked on Windows 10, Lo, 5.3.x and Linux, Lo 5.3.x
Comment 1 Xisco Faulí 2017-08-01 14:34:33 UTC
Thank you for reporting the bug.
Unfortunately without clear steps to reproduce it, we cannot track down the origin of the problem.
Please provide a clearer set of step-by-step instructions on how to reproduce the problem.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the steps are provided
Comment 2 Thomas Krumbein 2017-08-01 14:47:35 UTC
Hey Fauli,

"Unfortunately without clear steps to reproduce it, we cannot track down the origin of the problem." ???

That ist real stupid. All nessessary steps are declared even with API services.

The attached file do have a working code example inside. So I am sure- if you are really interested to solve the problem or even to understand - you do have all informations.

But for beginners:

- create a dialog inside the Basic IDE (graphice)
- put a dialog-Element "Progessbar" to this dialog
- write the code to start the dialog
- get the object of the progressbar
- change the foreground color i.e. to RGB(200,0,0) (this is red!)
- execute your dialog
- run the code for displaing progress bar -> foreground is green - I guess, this is a predefined value. 

Foregroundcolor do not have any effect. Just for tests: change property setbackgroundcolor() - an you can see the effect - that works;)

this is the code-segment out of the attached file:

sub Fortschrittsbalken
  Dim oCtl as object, i%
  oCtl = oDialog.getControl("ProgressBar1")
  oCtl.setRange(0, 100)

  for i = 1 to 100
    oDialog.getControl("Label9").text = CStr(i)
    oCtl.getModel().ProgressValue = i
    if oCtl.getValue/100 > 0.8 then
	oCtl.setForeGroundColor(RGB(200, 0, 0))
    end if
end sub

this should change progress-bar color to red by reaching 80% - an this works till min. OOo 3.2.1.
Comment 3 Regina Henschel 2017-08-01 19:02:13 UTC
It does not work for me with OpenOffice 3.2.1 OOO320m18(Build:9502) on Windows 7, 32 bit. Do you have a build number for the working version?

It works for me with OOo2.4.3, but that has a different kind of progress bar.
Comment 4 Julien Nabet 2017-08-01 22:22:54 UTC
Created attachment 135059 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.

Quite naively, I thought that by finding where setBackground is called I could find the missing mechanism for setForeground.
Here's the bt, I don't see anything obvious but I'm not expert.
Comment 5 Thomas Krumbein 2017-08-02 05:54:33 UTC
@ Regina: No, sorry, I do nit have such an old version;)

Example was part of mey book "OpenOffice.org 3 Macros" which I momentary rework. 

Methode is still part of the com.sun.star.awt.XProgressBar Interfache - so, if it doesn´t work and nobody care´s about - methode should be removed.

Otherwise... then there is no possibility to change color of progressbar.
Comment 6 Julien Nabet 2017-08-02 07:08:39 UTC
About your Xisco's response, have in mind that:
- there are hundreds of bugs in LO so the first goal is to be able to reproduce the problem quickly. It means in this case: just a snippet showing the bug and minimum steps to reproduce (just click a button would have been great) since it seems you know well Basic, I think it would have been quick and easy
- not anyone knows how to use Basic + know German so providing an example in English is a good idea

About your last response:
as a dev, I suppose you know that you can't change a public interface

Now if you want to get involved in LO (Dev, QA, doc or other), you can start here:
https://www.libreoffice.org/community/get-involved/, we're pleased to receive some patches.
But please stop being condenscending.
Comment 7 Regina Henschel 2017-08-04 18:39:32 UTC
The problem came in, when OpenOffice.org has switched to native controls. Setting the environment variable SAL_NO_NWF=true, you can disable the native widget look. Then you get the self-painted controls and for them, setting the foreground color works.
Comment 8 Thomas Krumbein 2017-08-06 11:59:50 UTC
Thanks Regina for this Information.

It is part of my "Macro Book" and because I will not compile LO and even "normal" user will not do this, I will remove this part of information out of the book and just put in a short message, that hthis will not work in standard LO versions. 

by the way... it does not work with AOO too.

So, task can be closed.
Comment 9 Regina Henschel 2017-08-06 14:44:53 UTC
There exists some questions in the Windows forums, but in all answers I have read, only two options are mentioned: (1) Disable Visual Styles (which would make controls look like in Windows98) or (2) paint your own control. Conclusion: Windows has no method to change the color for a single progressbar, but the color is bound to the Windows UI theme.

I suggest not to close this bug. I have changed the component to "sdk". Request: Add a remark to the description of setForeGroundColor(), that it has no effect on Windows OS.

I don't know, whether other OS are affected too. This needs to be checked. If other OS have the same problem, then this method should be marked as "deprecated".
Comment 10 Thomas Krumbein 2017-08-06 15:15:28 UTC
Linux Mint 18:  same behaviour - setForeGroundColor() has no effect
Comment 11 QA Administrators 2018-08-07 02:32:53 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team