PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Cho Sing Kum on December 23, 2009, 12:23:51 AM

Title: Windows Theme and Some Standard Controls
Post by: Cho Sing Kum on December 23, 2009, 12:23:51 AM
When changing Windows Theme, the BackColor of the following standard controls do not seem to synchronize after the change. The BackColor is the same as the Form which is the default ButtonFace system color.

Label
CheckBox
OptionButton
Frame

I have tried both Opaque and Transparent and the result is the same.

This happens only when Windows Theme is changed while the compiled exe is running.
Title: Re: Windows Theme and Some Standard Controls
Post by: Paul Squires on December 23, 2009, 08:18:52 AM
This is the nature of Windows... with Themes, the backcolor can't be set sometimes.
Title: Re: Windows Theme and Some Standard Controls
Post by: Cho Sing Kum on December 23, 2009, 11:16:26 AM
My understanding is this shouldn't be like this.

The BackColor for the mentioned standards controls and the form are the same, which is the ButtonFace system color. Whatever the theme, they should appear the same.

This problem occur while the exe is running when the theme is changed. If the exe is run again after the theme has changed, the problem does not occur.

I am still very new to PB and FF, coming over from VB6. While with VB6, I did use some 3rd-party controls that had somewhat similar problem.

I am not familiar yet with windows messages but I understand that occur because the controls are not reacting correctly to the message coming from Windows that the theme has changed.

I attached a screen shot I took of the similiar project in VB6 and FF3/PB. Notice that the one in VB6 reacted correctly.
Title: Re: Windows Theme and Some Standard Controls
Post by: Cho Sing Kum on December 23, 2009, 03:44:04 PM
Quote
This is the nature of Windows... with Themes, the backcolor can't be set sometimes.

I think this is not quite correct. It is the FORECOLOR of Frame, CheckBox and OptionButton that cannot be changed with Themes.

The BackColor CAN be changed. If the BackColor is set to a System color, then it will change accordingly to the corresponding System color of the new Theme automatically when the Theme is changed while the program is running.

Title: Re: Windows Theme and Some Standard Controls
Post by: Roger Garstang on December 23, 2009, 04:13:32 PM
I can confirm something wrong going on here Paul.  Previous FF2 apps of mine redraw the colors correctly when I change themes or colors in Display options.  FF3 apps aren't showing the normal effect of not redrawing, but in fact are redrawing...but with the wrong color.  I usually have a Zune Black theme where Button Face is Light Gray.  Changing to the Blue Theme where Button Face should be a Blueish Gray and Frames, Labels and even Textbox backgrounds that should be white in both all go Dark Gray (A color not in either Theme).  I looked at the new function FF3 uses to set control values and the message processing for Theme/Color changes in CodeGen and couldn't see anything that jumped out at me.  I'll look a little deeper.
Title: Re: Windows Theme and Some Standard Controls
Post by: Roger Garstang on December 23, 2009, 05:54:40 PM
Code found in CodeGen.  Comment out/Delete the line I commented out below and it works fine.  Looks like in converting everything to the new GetSysColorBrush you(Paul) got carried away and set your nBackColor to an RGB instead of leaving it the index like IsBackSysColor is testing for.


Function FLY_EnumSysColorChangeProc( ByVal hWnd As Dword, lParam As Long ) As Long
   Local ff As FLY_DATA Ptr
   
   ff = GetProp(hWnd, "FLY_PTR")
   If ff Then
      If @ff.ProcessCtlColor Then
         
         ' Create the new colors/brushes if we are using System colors
         If @ff.IsForeSysColor Then @ff.nForeColor = GetSysColor(@ff.nForeColor)
         If @ff.IsBackSysColor Then
            '@ff.nBackColor = GetSysColor(@ff.nBackColor)
            If @ff.hBackBrush Then DeleteObject @ff.hBackBrush
            @ff.hBackBrush = GetSysColorBrush(@ff.nBackColor)
         End If

      End If
   End If
   
   Function = %TRUE
End Function 
Title: Re: Windows Theme and Some Standard Controls
Post by: Cho Sing Kum on December 24, 2009, 04:04:14 AM
Roger,

Thanks.

I confirm that removing that line makes the BackColor change to the correct  corresponding color. I tested this with both Opaque and Transparent.
Title: Re: Windows Theme and Some Standard Controls
Post by: Paul Squires on January 05, 2010, 12:29:38 PM
Thanks guys, I have made the change. The fix will be in v3.06.
Title: Re: Windows Theme and Some Standard Controls
Post by: Pedro Marquez on November 07, 2013, 07:50:53 PM
¿ is possible background color transparent ?

CheckBox
OptionButton