![]() |
ComboBox issues |
Post Reply ![]() |
Author | |
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 933 |
![]() ![]() ![]() ![]() ![]() 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.
|
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 933 |
![]() ![]() ![]() ![]() ![]() |
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).
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |