Abo-Mota Posted November 27, 2018 Share Posted November 27, 2018 I am new to programing. How can i put more than one item in combo box I use this fumction GuiCtrlSetData() but it puts only one item Regards, Abo-Mota 😉, My FaceBook , 🌺 صلي ع النبي و تبسم 🌺 Link to comment Share on other sites More sharing options...
AutoBert Posted November 27, 2018 Share Posted November 27, 2018 Use the separator (standard = '|') to add more than one item in combo box. ; Add additional items to the combobox. GUICtrlSetData($idComboBox, "Item 2|Item 3", "Item 2") Just test the example script in help for GUICtrlCreateCombo. Abo-Mota 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 27, 2018 Moderators Share Posted November 27, 2018 @Abo-Mota as is always the case, there are multiple ways to skin the proverbial cat with AutoIt. If you have a large amount of text you want to add to the combobox, in addition to AutoBert's suggestion you can also add an array, like so: #include <Array.au3> #include <GUIConstantsEx.au3> Local $hGUI = GuiCreate("Test", 300, 400) Local $hCombo = GUICtrlCreateCombo("", 10, 10, 100, 40) Local $aArray[7] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] GUICtrlSetData($hCombo, _ArrayToString($aArray, "|")) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Abo-Mota 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Abo-Mota Posted November 27, 2018 Author Share Posted November 27, 2018 4 hours ago, AutoBert said: Use the separator (standard = '|') to add more than one item in combo box. ; Add additional items to the combobox. GUICtrlSetData($idComboBox, "Item 2|Item 3", "Item 2") Just test the example script in help for GUICtrlCreateCombo. Thx. it works! Regards, Abo-Mota 😉, My FaceBook , 🌺 صلي ع النبي و تبسم 🌺 Link to comment Share on other sites More sharing options...
Abo-Mota Posted November 28, 2018 Author Share Posted November 28, 2018 18 hours ago, JLogan3o13 said: @Abo-Mota as is always the case, there are multiple ways to skin the proverbial cat with AutoIt. If you have a large amount of text you want to add to the combobox, in addition to AutoBert's suggestion you can also add an array, like so: #include <Array.au3> #include <GUIConstantsEx.au3> Local $hGUI = GuiCreate("Test", 300, 400) Local $hCombo = GUICtrlCreateCombo("", 10, 10, 100, 40) Local $aArray[7] = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] GUICtrlSetData($hCombo, _ArrayToString($aArray, "|")) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Thanks 👍 Regards, Abo-Mota 😉, My FaceBook , 🌺 صلي ع النبي و تبسم 🌺 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