APPLEEATER Posted October 29, 2008 Share Posted October 29, 2008 Hello I've got this problem i need to get the items from an listbox and a combo box the controls are both in my gui (if that matters) i need them sent to an array it it works if it is sent to a string separated by a character too I have tried GUICtrlRead() and ControlGetText() But these only return the selected one Thanks alot for any help Link to comment Share on other sites More sharing options...
Zedna Posted October 29, 2008 Share Posted October 29, 2008 ListBox: _GUICtrlListBox_GetCount(), _GUICtrlListBox_GetText() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
APPLEEATER Posted October 30, 2008 Author Share Posted October 30, 2008 (edited) Now my problem is different :S This code: $temp = StringSplit(GUICtrlRead($CitemsE), ",") $tmax = _ArrayMaxIndex($temp) + 1 _GUICtrlListBox_ResetContent($Cindex[$Cindx]) For $i = 1 To $tmax _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i]) Next Does not always work?? My example string is 1,2,3,4,5,6,7 And the listbox only has 1 item in it "1" The other one is 1,2 and that is the same then i tried 7,3 and that worked just fine! what is wrong with this? Edit: Tried something new and it works: $temp = StringSplit(GUICtrlRead($CitemsE), ",") _GUICtrlListBox_ResetContent($Cindex[$Cindx]) For $i = 1 To $temp[0] _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i]) Next I'd still like to know what the difference is for the future? Edited October 30, 2008 by APPLEEATER Link to comment Share on other sites More sharing options...
oMBRa Posted October 30, 2008 Share Posted October 30, 2008 post whole script Link to comment Share on other sites More sharing options...
Achilles Posted October 31, 2008 Share Posted October 31, 2008 Now my problem is different :S This code: $temp = StringSplit(GUICtrlRead($CitemsE), ",") $tmax = _ArrayMaxIndex($temp) + 1 _GUICtrlListBox_ResetContent($Cindex[$Cindx]) For $i = 1 To $tmax _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i]) Next Does not always work?? My example string is 1,2,3,4,5,6,7 And the listbox only has 1 item in it "1" The other one is 1,2 and that is the same then i tried 7,3 and that worked just fine! what is wrong with this? Edit: Tried something new and it works: $temp = StringSplit(GUICtrlRead($CitemsE), ",") _GUICtrlListBox_ResetContent($Cindex[$Cindx]) For $i = 1 To $temp[0] _GUICtrlListBox_AddString($Cindex[$Cindx], $temp[$i]) Next I'd still like to know what the difference is for the future?_ArrayMaxIndex() returns the index of the greatest item, not the last item. Use the UBound() function to get the size of an array. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
APPLEEATER Posted October 31, 2008 Author Share Posted October 31, 2008 _ArrayMaxIndex() returns the index of the greatest item, not the last item. Use the UBound() function to get the size of an array.Wowi really didn't know that...i wonder why all the other scripts that used _ArrayMaxIndex() worked...anywaythanks Link to comment Share on other sites More sharing options...
Achilles Posted October 31, 2008 Share Posted October 31, 2008 Wowi really didn't know that...i wonder why all the other scripts that used _ArrayMaxIndex() worked...anywaythanks The array probably were sorted and had the biggest item last, that's my guess at least... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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