MaartenDuits Posted November 28, 2009 Share Posted November 28, 2009 Hi, I created a combobox, what i am wondering is how can i validate if the value is in the combobox? For example: Combo has possible values A, B and C If user enters D how can i validate if the D is one of the possible values? Hope somebody can help me. Thx in advance. Kind regards, Maarten. Kind regards,Maarten Link to comment Share on other sites More sharing options...
EndFunc Posted November 28, 2009 Share Posted November 28, 2009 (edited) First, You use GuiCtrlRead() to read the value of the Combobox. Then you can compare the value read with whatever else and then perform an action or something. 2nd, If your ComboBox is not static I would make it so. Don't allow the user to input any data themselves into the ComboBox. Usually when I make a ComboBox I only want them to have the choices that I put there. So create the combobox with the $CBS_DROPDOWNLIST style so that it's readonly to the user. e.g. #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, "", "", $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 Edited November 29, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
MaartenDuits Posted November 29, 2009 Author Share Posted November 29, 2009 Hello EndFunc, Thx for the reply. This is exactly what i was looking for!! Thx again. Maarten. Kind regards,Maarten Link to comment Share on other sites More sharing options...
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