Jump to content
Sign in to follow this  
Brakefield

Disable Combo Box editing?

Recommended Posts

Brakefield

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

Share this post


Link to post
Share on other sites
sandin

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
?

Share this post


Link to post
Share on other sites
enaiman

Use: $CBS_DROPDOWNLIST for ComboBox's style

GUICtrlCreateCombo("item1", 10, 10, 50, 17,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL) )

  • Like 1

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Brakefield

Beautiful thanks - exactly what I was looking for.

Share this post


Link to post
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
Sign in to follow this  

×