Jump to content

Disable Combo Box editing?


Recommended Posts

Hey guys and girls, a quick question for you all:

Is there a way to disable the combo-box from being edited?

I tried applying a few different styles -- $ES_READONLY was in particular fitting the description of what I want to do, but that only messed up the combo-box all together, as that particular style is part of the Input/Edit fields.

Here's an example right out of the help menu -- if you give it a try, you'll see that that you can type right into the combo box, an undesired nor aesthetically pleasing "feature":

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
    GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered

    GUICtrlCreateCombo("item1", 10, 10); create first item
    GUICtrlSetData(-1, "item2|item3", "item3"); add other item snd set a new default

    GUISetState()

   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example

Any help is greatly appreciated.

example.au3

Link to comment
Share on other sites

did you mean something like this:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
Opt('MustDeclareVars', 1)
Example()
Func Example()
    Local $msg
    GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
    GUICtrlCreateCombo("item1", 10, 10, -1, -1, $CBS_DROPDOWNLIST); create first item
    GUICtrlSetData(-1, "item2|item3", "item3"); add other item snd set a new default
    GUISetState()
   ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example
?
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...