Jump to content

ComboBox ReadOnly


Recommended Posts

There is a control or property for the combo box that makes the combo list read-only. Where by the user can only select items in the combo box as a list. You cannot edit the combo box and the items in the drop down list appear as a list item would appear.

Can anyone give some examples?

Link to comment
Share on other sites

There is a control or property for the combo box that makes the combo list read-only. Where by the user can only select items in the combo box as a list. You cannot edit the combo box and the items in the drop down list appear as a list item would appear.

Can anyone give some examples?

Try this

#include <GuiCombo.au3>
#include <GUIConstants.au3>
$cbex = GUICreate("can't edit the combobox",300,200)

$Combo = GUICtrlCreateCombo("", 18, 100, 200, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
GUISetState(@SW_SHOW)

GUICtrlSendMsg($Combo ,$EM_SETREADONLY,false, 0)

for $n = 1 to 10
GUICtrlSetData($Combo,'item ' & $n)
Next
GUICtrlSetData($Combo,'item 1')

while 1

$m = GUIGetMsg()
if $m = $GUI_EVENT_CLOSE then ExitLoop
    
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Try this

Why GUICtrlSendMsg($Combo ,$EM_SETREADONLY,false, 0) and #include <GuiCombo.au3> ?

#include <GUIConstants.au3>

GUICreate('', 120, 40)
GUICtrlCreateCombo('', 10, 10, 100, 200, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL))

For $i = 1 To 50
    GUICtrlSetData(-1, 'Entry ' & $i)
Next
GUICtrlSetData(-1, 'Entry 1')

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd
Link to comment
Share on other sites

Why GUICtrlSendMsg($Combo ,$EM_SETREADONLY,false, 0) and #include <GuiCombo.au3> ?

@xcal: Yes you're right. I didn't need those lines so they should have been removed.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...