Newb Posted January 23, 2011 Share Posted January 23, 2011 Hi,I need to know if it's possible to put in a list, array or get a number ID for the list elements of a combo box.Global $ComboTrainNowWhat = GUICtrlCreateCombo("", 88, 177, 113, 25,0x3) GuiCtrlSetData(-1,"Element A|Element B|Element C|Element D","Element 1")I need to get some kind of ID for these elements so I can do this:If ELEMENT NR.1 is selected Then (script)If ELEMENT NR 2 is selected then (script)And so on. I need to do this because I have a very much populated combo box (32 elements) And i Would have to assign a single value or check every single one of them to see which one is selected.Other problem is given by the fact that I don't have a scrollbar on the drop down list of the combo box. Only 30 elements are displayed, but I need to see all 32 of them. Only solution is to keep the mouse clicked and scroll down with the cursor...I found which suggests to put increase height to the Combo Box, but i tried also to put 250 to the height but nothing happens, it seems only 30 elements are displayed....How I can display them all?And how i can have an Id for those elements? I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
guinness Posted January 23, 2011 Share Posted January 23, 2011 (edited) Maybe _GUICtrlComboBox_GetCurSel() &_GUICtrlComboBox_SetMinVisible() And this displays 100 elements with a Scrollbar. #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> Example() Func Example() GUICreate("GUI") Local $Combo = GUICtrlCreateCombo("", 10, 10) For $A = 0 To 100 _GUICtrlComboBox_AddString(GUICtrlGetHandle($Combo), "Example " & $A + 1) Next _GUICtrlComboBox_SetMinVisible(GUICtrlGetHandle($Combo), 32) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example Edited January 23, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
GEOSoft Posted January 23, 2011 Share Posted January 23, 2011 #include <ComboConstants.au3> #Include <GuiComboBoxEx.au3>; see the commented code block $sData = "" For $i = 1 To 40 $sData &= "|Element " & $i Next GUICreate("Test Window") Global $ComboTrainNowWhat = GUICtrlCreateCombo("", 88, 77, 113, 600,BitOr($GUI_SS_DEFAULT_COMBO,$CBS_DROPDOWNLIST)) GUICtrlSetData($ComboTrainNowWhat, $sData, "Element 1") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case $ComboTrainNowWhat MsgBox(0, "Result", GUICtrlRead($Msg)) #cs ;Best would be to use use a switch in here ;Switching on the selected index # Switch _GUICtrlComboBoxEx_GetCurSel($Msg) Case 0 ;; First position is 0 not 1 ; Do Something Case 1 ;Do Something else EndSwitch #ce EndSwitch WEnd George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Newb Posted January 24, 2011 Author Share Posted January 24, 2011 Thanks, it worked. I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. 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