yehia Posted March 27, 2009 Share Posted March 27, 2009 searched alot in forum and in help file and there is no function to set the index of an already existing listview item did i miss anything? is there something like _GuiCtrlListview_SetItemIndex can anyone help? thanks My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
maqleod Posted March 28, 2009 Share Posted March 28, 2009 searched alot in forum and in help file and there is no function to set the index of an already existing listview item did i miss anything?is there something like _GuiCtrlListview_SetItemIndexcan anyone help?thankslook at _GUICtrlListView_GetItemTextArray() and _GUICtrlListView_SetItemText()you will have to get the list of items, and then set item texts as needed in the order you want them. I've done something like this for a move up/down function within a listview in the past [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
yehia Posted March 28, 2009 Author Share Posted March 28, 2009 my list view contains about 27 item so i guess that wont be an option any other solutions? My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 28, 2009 Moderators Share Posted March 28, 2009 yehia,Why are you dismissing maqleod's suggestion? How are you getting the data to populate your ListView - would it already be in array form perhaps? I have used something very similar to maqleod's idea to manipulate ListViews with many more than 27 items which are stored in an array. Here is an code snippet to move an item up the ListView by moving its position in the array and then rewriting the ListView itself:Func List_Item_Up(ByRef $aList_Array, $hList, $hStart_ID) ; $hStart_ID is dummy control cretaed to enumerate ListView item ControlIDs If $aList_Array[0] < 2 Then Return ; Get value of listview selection via handle count $iList_Index = GUICtrlRead($hList) - $hStart_ID ; If already at top or no selection or out of range If $iList_Index < 2 Or $iList_Index > $aList_Array[0] Then Return ; Swap array elements _ArraySwap($aList_Array[$iList_Index], $aList_Array[$iList_Index - 1]) ; Rewrite list items For $i = 1 To $aList_Array[0] GUICtrlSetData($hStart_ID + $i, $aList_Array[$i]) Next ; Unselect all items to force selection before next action _GUICtrlListView_SetItemSelected ($hList, -1, False) EndFuncOf course, the visual penalty of the change in contents is only noticeable for the 2 items involved - all the others remain stable. I have also rewritten ListViews where many items change - here I have just used GUICtrlSetState($hList_View, $GUI_HIDE/SHOW) to hide the ListView for the short time it takes to rewrite. Yes, you can see that something is happening, but the delay is minimal - and I am talking of over 200 items with multiple subitems.M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
yehia Posted March 28, 2009 Author Share Posted March 28, 2009 my problem with that solution is that my list view is an external one and using item set text while moving the item down like 20 times will destroy the link between the listview item and the program My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 28, 2009 Moderators Share Posted March 28, 2009 yehia, Are you saying that the ListView you are trying to manipulate is in a non-AutoIt application? M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
yehia Posted March 28, 2009 Author Share Posted March 28, 2009 yes every _GUICtrlListView_Command worked with it and still i cant find away to set the index without destroying its main function thanks alot for your help My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
yehia Posted March 31, 2009 Author Share Posted March 31, 2009 bump there must be away anyone knows? My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
WideBoyDixon Posted March 31, 2009 Share Posted March 31, 2009 Are you looking for _GUICtrlListView_SetItemSelected() ? [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
yehia Posted March 31, 2009 Author Share Posted March 31, 2009 nah _GUICtrlListView_SetItemSelected() set the item selected giving the item index My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
yehia Posted April 1, 2009 Author Share Posted April 1, 2009 bump ... My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
yehia Posted April 3, 2009 Author Share Posted April 3, 2009 last bump im really giving up seems that there is no way to do it My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine 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