Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - ComboBox issues
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ComboBox issues

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 933
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: ComboBox issues
    Posted: 17 April 2025 at 2:21pm
So I have encountered another issue with ComboBox. This one is odd. We supply images for the combobox which are dark. When I am running without our skin applied and have a dialog up that has a normal ComboBox on it and then I apply the skin all the windows update. But the ComboBox doesn't appear correctly.

If I apply the skin and then bring up the same dialog, the combobox looks fine. The ComboBox that is on a dialog when I apply the skin appears to be a combination (yeah) of skinned and unskinned. The outline and drop arrow are skinned but the rest is not.

I gave up trying to determine why it happens. For now I resorted to adding code to destroy the current comboboxes when a dialog is present with any and recreating them. The newly created comboboxes look just fine. I see the same issue for any combobox on any dialog. Fortunately we don't have many but we do have a few dialogs we create one time. I added code to handle WM_SYSCOLORCHANGE and if we have our skin running I recreate the comboboxes when that call arrives.

I tried to find one of the CJ skin samples that have comoboxes and a skin that changes them but I didn't find any. The drop box always works fine, by the way.

For reference here is our dialog where the user can choose one of CJ's Office 2016 color themes. Our "Dark" is the "black" theme and we also load our dark skin. See the "Application color scheme" combobox. It looks correct. So does the "Steering Wheel .." combo box below it with "Extra Large" text.

Here is the same dialog when we are not using the skin.

And here is the same dialog after I switch the Application color theme to Dark which applies the skin while the dialog is still visible.
The ComboBox with "Dark" in it has the selected color we use all across the dialog. Dismissing the dialog and bringing it back up with Dark already set is what we want to see which is what the first image shows.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 933
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 5 hours 58 minutes ago at 1:25pm
I have noticed that even in SkinBuilder changing ComboBox settings rarely or never affects the combobox in the SkinBuilder window. Same for ListView and ListBox.

I also added code to CXTPSkinObjectComboBox::OnDraw to get the DC text color, which is always black even when our theme indicates it is white.

I also added code (this is all for debug) to get the logical brush color from the brush returned from GetFillBackgroundBrush and it is the color I expected. Even for the windows in the dialog image I posted here that show a white background.



I see this in OnDraw but textThemeColor is never used:

    COLORREF textThemeColor = pClassComboBox->GetThemeColor(0, nState, TMT_TEXTCOLOR);

I used that color to draw the text and still the text color is wrong. Since I only have these combobox issues. That didn't help.

I tried using the m_bPaint member to avoid the double/recursive calls that occur based on whether the box being drawn has focus that was a disaster (no text in any of those boxes in my image).

So finally I found a way out of this that lets me avoid destroying and recreating comboboxes that still exist when I apply the skin. I have found this same approach also fixes issues with .NET controls that won't draw correctly with the skin (or don't use the skin settings). I turn off the combobox Window theme when we switch to our skin. Then if the user turns off our color theme which uses the skin, I reinstate the current window theme.

Luckily I already have code that notifies all existing windows of the color theme change and whether the new or previous color theme included a skin. I have that since a lot of our UI needs adjusted, such as loading new images in image lists or whatever when the skin is dark.

So I just get each window class name and if it is a combobox/comboboxex I either disable the system theme SetWindowTheme(hWnd,L"",L""); or reset the window to use the current OS theme - SetWindowTheme(hWnd,nullptr,nullptr).

Not optimal but the CJ combobox skin code and the OS just are not cooperating if the skin is applied while the combobox already exists (visible or not).
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.