Applied Greg’s workaround to original code and it works, but the Progress Bar painted on the Listbox is gray. Then, when I click them and elsewhere they paint blue:
As a workaround I have to put:
Me.Invalidate
on GotFocus event. Of course, this works for this sample, if the Listbox start without focus then they will stay gray until the Listbox get focus. And after the first invalidate they stay blue, so there is no need to invalidate again or every time the focus is set on the Listbox.
From what I see, ProgressBar is only dark gray when it is not the front most window (working on other app for example).
I can’t find a Feedback case for this.
Note: I think the IDE will look better if the ProgressBar there is blue and not gray.
It looks like when the first paint is done with default values or by using Open event to AddRows, the ProgressBar is gray and that’s why the ProgressBar in the Listbox is gray.
If I remove the default values and create a button to AddRows to the listbox, then the ProgressBar is blue.
If I have a default value (gray) and add another Row, then both turn blue because the CellTextPaint event is executed again for all rows and now it copies a blue ProgressBar, right?
Not knowing how things work on the OS level, do you think there is something that Xojo can change to make it work correctly for default/open event values?
Maybe I needed to post the code that is on Listbox1 CellTextPaint event:
Dim p As New picture(g.Width, g.Height)
progressbar1.DrawInto(p.Graphics, progressbar1.Left, 0)
g.DrawPicture p, 0, 0
Return True
Changed AutoDeactivate to OFF and I get the same.
[quote=412792:@EmileSchwarz]The color is grey when the window is not frontmost (even if I can sear it is).
A click make the window really frontmost and so the color change to blue.[/quote]
Do you think that when the window is created and the CellTextPaint event is fired just before the window is the frontmost one, and for that is drawing a gray progressbar into the listbox. After the window is fully created then progressbar1 change to blue if it foremost and if not is foremost then change to gray, but because the window is refreshed everything looks ok (all gray when is not foremost and blue when it is)