Jump to content

Disable ComboBox editing


WhyTea
 Share

Recommended Posts

Link to comment
Share on other sites

Yes!! The editing is the default style, so to change it just set the style to: $CBS_DROPDOWNLIST (requires #include<ComboConstants.au3>), or 0x0003.

#include<ComboConstants.au3>

$hGUI = GUICreate ("Testing combo box")
GUICtrlCreateCombo ("", 2, 2, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData (-1, "Item 1|Item 2|Item 3", "Item 1")
GUISetState ()
While GUIGetMsg () <> -3
WEnd

Mat

Link to comment
Share on other sites

  • 9 years later...
On 22/09/2009 at 1:57 PM, Mat said:

Yes!! The editing is the default style, so to change it just set the style to: $CBS_DROPDOWNLIST (requires #include<ComboConstants.au3>), or 0x0003.

 

 

#include<ComboConstants.au3>

$hGUI = GUICreate ("Testing combo box")
GUICtrlCreateCombo ("", 2, 2, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData (-1, "Item 1|Item 2|Item 3", "Item 1")
GUISetState ()
While GUIGetMsg () <> -3
WEnd

 

Mat

Hi,

I know this is an almost 10 year old thread but my question is relevant to this topic. When I use  $CBS_DROPDOWNLIST, If my combo has a lot of elements, it won't scroll through them all. it only shows the ones that fit the height value. Is there anything else I can add to this to have both scroll and entries disabled? I've looked in the GUI Control Styles but found nothing.

 

EDIT: Nevermind, found it. GUICtrlCreateCombo( "Combo", 45, 30, 400, 100, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))

Edited by Moist
Link to comment
Share on other sites

Technically the most correct is to use $GUI_SS_DEFAULT_COMBO style as noted in Helpfile for GUICtrlCreateCombo().

 

So instead of

GUICtrlCreateCombo ("", 2, 2, 100, 20, $CBS_DROPDOWNLIST)

You should use

GUICtrlCreateCombo ("", 2, 2, 100, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST))

and in this case there will be also vertical scrollbar which is included in $GUI_SS_DEFAULT_COMBO (among other default styles)

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...