myspacee Posted May 23, 2010 Posted May 23, 2010 Hello to all, how i can deny my users to not edit GUICtrlCreateCombo ? expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIComboBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GUIConstants.au3> Opt('MustDeclareVars', 1) #include <Array.au3> dim $file, $line, $Button_ok, $Button_cancel, $msg dim $avArray[1] dim $hCombo ;//////////////////////////////////////////////////////////////////////// ; GUI ;//////////////////////////////////////////////////////////////////////// #Region ### START Koda GUI section ### Form= GUICreate("ComboBox select from list", 396, 296) ;~ $_1 = GUICreate("ComboBox seleziona dalla lista", 247, 718, 393, 133) $hCombo = GUICtrlCreateCombo("", 2, 60, 396, 296, BitOR($CBS_SIMPLE,$CBS_AUTOHSCROLL,$CBS_DISABLENOSCROLL,$WS_VSCROLL)) $Button_ok = GUICtrlCreateButton("OK", 16, 32, 81, 25, 0) $Button_cancel = GUICtrlCreateButton("Cancel", 144, 32, 81, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;//////////////////////////////////////////////////////////////////////// ; OPEN text file ;//////////////////////////////////////////////////////////////////////// $file = FileOpen("list.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;//////////////////////////////////////////////////////////////////////// ; populate COMBO ;//////////////////////////////////////////////////////////////////////// ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ; Add files _GUICtrlComboBox_BeginUpdate($hCombo) ;~ ; Add string _GUICtrlComboBox_AddString($hCombo, $line) ;~ ; update _GUICtrlComboBox_EndUpdate($hCombo) ; select string _GUICtrlComboBox_SelectString($hCombo, "This") Wend FileClose($file) ;//////////////////////////////////////////////////////////////////////// ; GUI until user action ;//////////////////////////////////////////////////////////////////////// While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button_ok msgbox(0,"","ok") Case $Button_cancel msgbox(0,"","cancel") ExitLoop EndSwitch WEnd GUIDelete() msgbox(0,"","bye!") thank you for any info, m.
Makaule Posted May 23, 2010 Posted May 23, 2010 Try to use $CBS_DROPDOWNLIST, for example:$ComboBox = GUICtrlCreateCombo("", 90, 40, 380, 25, $CBS_DROPDOWNLIST)
Fire Posted May 23, 2010 Posted May 23, 2010 (edited) #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $Form1 = GUICreate("TEST FORM", 217, 162, 192, 124) $Combo1 = GUICtrlCreateCombo("", 32, 24, 161, 25,BitOR($WS_VSCROLL,$ES_READONLY,$CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetBkColor(-1,0xFFFFFF) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $i=0 Do $i+=1 GUICtrlSetData($Combo1,$i & "|") Until $i=100 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd edit: Added GUICtrlSetBkColor(-1,0xFFFFFF) Edited May 23, 2010 by Fire [size="5"] [/size]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now