gobsor Posted August 24, 2010 Share Posted August 24, 2010 Heyah... once more a problem with ListView! That's how I'm filling the ListView after browsing a dir, notice that I'm using _GUICtrlListView_SetItemSelected($hSourceView, 0, True, True). Works perfect, ListView is being filled and 1st item is Focused/Highlighted (in common blue 'this row is highlighted' color). Func _fillSourceView($path) _clearListView($hSourceView) $files = _FileListToArray($path, "*.mp3") For $i = 1 To UBound($files)-1 $size = FileGetSize($path&$files[$i]) _GUICtrlListView_BeginUpdate($hSourceView) GUICtrlCreateListViewItem(_properNum($i) & "|" & $files[$i] & "|" & _properSize($size), $hSourceView) If Mod($i, 2) = 0 Then GUICtrlSetBkColor(-1, 0xE9F2F5) EndIf Next _GUICtrlListView_SetItemSelected($hSourceView, 0, True, True) $iIndex = 0 _GUICtrlListView_EndUpdate($hSourceView) _GUICtrlButton_Enable($idReload, True) EndFunc ;==> _fillSourceView($path) Okay, now I got two buttons to move subitems down/up in ListView, that's how I'm doing it: Func _clickMoveUp() _GUICtrlListView_BeginUpdate($hSourceView) _switchItemText($hSourceView, $iIndex, $iIndex-1, 1) _switchItemText($hSourceView, $iIndex, $iIndex-1, 2) _GUICtrlListView_SetItemSelected($hSourceView, $iIndex-1, True, True) _GUICtrlListView_EndUpdate($hSourceView) $iIndex = $iIndex - 1 EndFunc ;==> _clickMoveUp() Func _clickMoveDn() _GUICtrlListView_BeginUpdate($hSourceView) _switchItemText($hSourceView, $iIndex, $iIndex+1, 1) _switchItemText($hSourceView, $iIndex, $iIndex+1, 2) _GUICtrlListView_SetItemSelected($hSourceView, $iIndex+1, True, True) _GUICtrlListView_EndUpdate($hSourceView) $iIndex = $iIndex + 1 EndFunc ;==> _clickMoveDn() Func _switchItemText($hWnd, $iIndex_1, $iIndex_2, $iSubItem) Local $temp = _GUICtrlListView_GetItemText($hWnd, $iIndex_1, $iSubItem) _GUICtrlListView_BeginUpdate($hWnd) _GUICtrlListView_SetItemText($hWnd, $iIndex_1, _GUICtrlListView_GetItemText($hWnd, $iIndex_2, $iSubItem), $iSubItem) _GUICtrlListView_SetItemText($hWnd, $iIndex_2, $temp, $iSubItem) _GUICtrlListView_EndUpdate($hWnd) EndFunc Works fine so far aswell, subitem is being moved up/down, depending on the button pressed, but why doesn't the moved item get highlighted after it got moved? Shouldn't _GUICtrlListView_SetItemSelected($hSourceView, $iIndex+1, True, True) _GUICtrlListView_SetItemSelected($hSourceView, $iIndex-1, True, True) move the 'highlight' down/up in ListView, depending on the button pressed? SubItem's are exchanged and I can move the selected one to either the button or the top of the list, but somehow it's not highlighted and hard to see which one is moved right now. Thanks in advance! Link to comment Share on other sites More sharing options...
gobsor Posted August 25, 2010 Author Share Posted August 25, 2010 Bumping this one since I couldn't solve it yet. Addition: I was told UDF do not always stack with native AU3 functions. Might that cause the problem, or is it me using the function improperly? Regards Link to comment Share on other sites More sharing options...
CMJ Posted September 4, 2010 Share Posted September 4, 2010 gobsor,I posted a similar question without realizing it. I figured out the answer to my question and maybe it will help you.See Here.Hope this helps.cj Link to comment Share on other sites More sharing options...
gobsor Posted September 12, 2010 Author Share Posted September 12, 2010 Thanks, works for me now too. Not really sure why $iVar is not working (I had the same issue, using a variable not Number()'ing it). Regards 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