FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Colored combobox on Windows 7
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 07:56 AM
The following sample works fine on XP but not on Windows 7 (it doesn't change the color of the combobox on W7):

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oCbx, cVar := ""

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cVar;
           ITEMS { "1", "2", "3" }

    @ 3, 1 BUTTON "Change color";
           ACTION ( oCbx:SetColor( , CLR_HRED ),;
                    oCbx:Refresh() )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 08:25 AM
Dear Enrico,

It is working fine here on W7 ultimate 32:

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 08:37 AM

I forgot to mention that the problem is only for themed apps. Please retry using the theme resource.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 02:53 PM

I would seem that themes should override color settings. How else can they work? How would a theme know which color settings to override and which not to?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 03:06 PM

On XP the comboboxes are correctly colored.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 03:19 PM

>On XP the comboboxes are correctly colored.

OK, but one wonders is that a bug, or by design? I still can't figure out how the theme knows which colors to change and which not to.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 03:27 PM

The other controls get correctly colored. Only the comboboxes are not colored.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 03:42 PM

I note the both TGet and Tcombobox inherit from TControl which inherits from TWindow. Only TWindow has a setColor() method so they all use this method. This will make it more difficult to figure out why TCombobox is not working the same as TGet.

I am making the assumption that TGet does display the colors set using setColor. Is that correct?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 03:57 PM

Yes.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 04:05 PM

There is a ctlColor() method in TWindow. It does not exist in TControl or TGet. However, there is a ctlColor() method in TCombobox so I think this is where the problem is.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Colored combobox on Windows 7
Posted: Wed Apr 28, 2010 04:20 PM

I don't have Win 7 here for testing, but you could try either commenting out the CtlColor() method in TCombobox or just calling the parent method instead.

Method CtlColor(...) Class TCombobox
return super:ctlColor(...)

If the color is then properly set, then this method is the problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Thu Apr 29, 2010 09:01 AM

Tried. No change. :-(

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Colored combobox on Windows 7
Posted: Thu Apr 29, 2010 10:55 AM
Dear Enrico,

Using themes, the dropdown list gets properly colored:



The combobox bar is painted by the Windows themes engine, so we should not change that, unless I am wrong :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Colored combobox on Windows 7
Posted: Thu Apr 29, 2010 11:27 AM

On XP the edit parts of the comboboxes get correctly colored.

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Colored combobox on Windows 7
Posted: Thu Apr 29, 2010 11:44 AM

Dear Enrico,

In your example, the combobox is not editable (does not contain a GET).

regards, saludos

Antonio Linares
www.fivetechsoft.com