Jump to content

How do I change change color in a special drop down menu?


Recommended Posts

Hello Forum, 

I have one special Combo-box [with BitOR($CBS_DROPDOWNLIST, $GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE) ] and if I press one button I want to change the Combo-box's background color, and after I press Button B I want to change it to the basic settings and it not works.

I wanna do this with one combo-box.

I have already tried several methods and I tried  GUICtrlComboSetColors that I have found on this forum.

(But this methods works perfectly with Cobo boxes that don't have BitOR($CBS_DROPDOWNLIST, $GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE). 

Here is the example code

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=   ;$CBS_DROPDOWNLIST ;$GUI_SS_DEFAULT_COMBO
$Form1 = GUICreate("Form1", 504, 249, 252, 227)
$Combo1 = GUICtrlCreateCombo("", 136, 24, 193, 25,BitOR($CBS_DROPDOWNLIST, $GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
; I want to change this special combo's background color if I press button 1
$Button1 = GUICtrlCreateButton("Button1", 112, 96, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 264, 96, 75, 25)
#EndRegion ### END Koda GUI section ###

GUICtrlSetData($Combo1," " & "|" & "apple"  & "|" & "banana" & "|" & "cherry" ," ")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE

        Case $Button1
        Case $Button2
            ;Makes the original bc color



Thanks you in advance your help

Link to comment
Share on other sites

As I mentioned before this UICtrlComboSetColors() function not works perfectly if I want to change a combo box color  and [with BitOR($CBS_DROPDOWNLIST, $GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE) ] I use this .


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...