How to iterate through items in a list box
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2017
01:40 PM
01-19-2017
01:40 PM
How to iterate through items in a list box
Hello Community
I have a drop-down list (aka combo-box) with multiple items. I would like to get the items count and select one randomly.
Thank you 🙂
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2017
03:04 PM
01-19-2017
03:04 PM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2017
04:07 PM
01-19-2017
04:07 PM
function SelectItemFromListBox(listControl:OleVariant, listValue:string): boolean; var i, itemIndex: integer; begin result := false; itemIndex := -1; for i := 0 to listControl.wItemCount - 1 do begin if listControl.wItem[i] = Value then begin itemIndex := i; break; end; end; if itemIndex < 0 then begin Log.Error('Item value ''' + VarToStr(listValue) + ''' not found in list control ' + VarToStr(listControl.FullName), nil, nil, nil, listControl.Picture); exit; end; listControl.Keys('[Home]'); for i := 0 to itemIndex - 1 do listControl.Keys('[Down]'); result := true; end;
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2017
12:25 AM
01-20-2017
12:25 AM
wItemCount - to get the list count.
wClickItem - to click the item based on the index or value.
More information, You can refer the @NisHera post.
Thanks
Shankar R
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”