[Gambas-user] Menubar background only changes to Form.Background on top level window (gtk3)

T Lee Davidson t.lee.davidson at gmail.com
Tue Jan 23 16:24:12 CET 2024


On 1/23/24 10:05, T Lee Davidson wrote:
> On 1/23/24 08:23, Bruce Steers wrote:
>>
>>
>> On Tue, 23 Jan 2024 at 02:52, T Lee Davidson <t.lee.davidson at gmail.com <mailto:t.lee.davidson at gmail.com>> wrote:
>>
>>     On 1/22/24 15:47, Bruce Steers wrote:
>>      > I have a couple of issues in a GUi build...
>>      >
>>      > Issue1
>>      > I can set Form Background / Foreground colors but then I get the following behavior with gtk3...
>>      > the Menubar background color changes to correct color only on the top level window but not other opened windows.
>>      > While the Foreground color changes on all windows.
>>      > Leaving a risk of having same color bg and fg on opened windows.
>>      >
>>      > QT it all works as expected.
>>      >
>>      > --------
>>      >
>>      > The other issue is with various gui text rendering.
>>      > If i set Form.Foreground = Color.White
>>      > Then things like Labels,MenuButton and others change to white text. things like Buttons/TogleButtons do not.
>>      > I have to add this code to make things render the correct text color...
>>      >
>>      >    For Each c As Control In Me.Controls
>>      >      c.Foreground = Me.Foreground
>>      >    Next
>>      >
>>      > But that's only a workaround and only viable if i have no explicit text colors set.
>>
>>     I find your description of the issue confusing.
>>
>>     When you refer to "other opened windows", do you mean other forms (which, of course, open in a new window)?
>>
>>     And, I'm not sure how you expect it to work. Because, with Qt:
>>     1. I create Form1 which a button event handler in FMain calls with Form1.Show
>>     2. FMain has foreground and background colors set to other than default
>>     3. Form1 has default foreground/background colors.
>>
>>     Fmain shows its colors as it should including the button text. Form1 shows its default colors.
>>
>>     That is what I would expect.
>>
>>     Am I missing something?
>>
>>
>> er, gtk3 ;)
>> Like I said these are gtk issues.  qt seems to work correctly.
> 
> [snip]
> 
> You grouped "QT it all works as expected" in with Issue1, and it seemed that you expected the opened forms (windows) to 
> automatically inherit the colors of the main form. So, I had to mention that I did not know what you exactly meant by "works as 
> expected" and pointed out that it does not work that way - even with Qt.
> 
> Are you creating the forms with the IDE and then changing the colors programmatically? Or are you also creating the forms 
> programmatically.

Okay, I just tried with GTK3; setting the color properties programmatically.

The menu-bar background is correctly set according to the form's background for the top-level and child windows. But, as you 
stated, the buttons do not respect the form's Foreground property.


-- 
Lee



More information about the User mailing list