| Description |
Hi,
i've used in SciTE the following script with Windows XP Home SP2. At first with Beta 3.1.1.5 .
After ending exists furthermore process AutoIt3.exe with an CPU load of 98 %.
Then i've updated to Beta 3.3.1.6 with same effect.
#include <EditConstants.au3>
#include <GuiRichEdit.au3>
$Form1 = GUICreate("Form1", 400, 500, 300, 220)
$Edit = _GUICtrlRichEdit_Create($Form1, "", 10, 10, 380, 360, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)
Do
Until GUIGetMsg() = -3
|
| Description |
With new Beta _GUICtrlListView_SimpleSort sorts checkboxes too, but association between item and ItemParam are lost by sort.
I've changed this function, so that it also sort ItemParam. Would nice to have this feature generally.
Func _GUICtrlListView_SimpleSort($hWnd, ByRef $vDescending, $iCol)
If $Debug_LV Then UDF_ValidateClassName($hWnd, $LISTVIEWCONSTANT_ClassName)
If _GUICtrlListView_GetItemCount($hWnd) Then
Local $b_desc
If (IsArray($vDescending)) Then
$b_desc = $vDescending[$iCol]
Else
$b_desc = $vDescending
EndIf
Local $columns = _GUICtrlListView_GetColumnCount($hWnd)
Local $items = _GUICtrlListView_GetItemCount($hWnd)
Local $temp_item = ""
Local $SeparatorChar = Opt('GUIDataSeparatorChar')
For $x = 1 To $columns
$temp_item = $temp_item & " " & $SeparatorChar
Next
$temp_item = StringTrimRight($temp_item, 1)
;~ Local $a_lv[$items][$columns + 1]
Local $a_lv[$items][$columns + 2], $i_selected ; add column for ItemParam ### MODIFIED ###
Local $i_selected = StringSplit(_GUICtrlListView_GetSelectedIndices($hWnd), $SeparatorChar)
Local $i_checked = StringSplit(GUICtrlListView_GetCheckedIndices($hWnd), $SeparatorChar)
Local $v_item, $iFocused = -1
For $x = 0 To UBound($a_lv) - 1 Step 1
If $iFocused = -1 Then
If _GUICtrlListView_GetItemFocused($hWnd, $x) Then $iFocused = $x
EndIf
_GUICtrlListView_SetItemSelected($hWnd, $x, False)
_GUICtrlListView_SetItemChecked($hWnd, $x, False)
;~ For $Y = 0 To UBound($a_lv, 2) - 2 Step 1
For $Y = 0 To UBound($a_lv, 2) - 3 Step 1 ; ### MODIFIED ###
$v_item = StringStripWS(_GUICtrlListView_GetItemText($hWnd, $x, $Y), 2)
If (StringIsFloat($v_item) Or StringIsInt($v_item)) Then
$a_lv[$x][$Y] = Number($v_item)
Else
$a_lv[$x][$Y] = $v_item
EndIf
Next
$a_lv[$x][$Y] = $x
$a_lv[$x][$Y + 1] = _GUICtrlListView_GetItemParam($hWnd, $x) ; read ItemParam ### NEW ###
Next
_ArraySort($a_lv, $b_desc, 0, 0, $iCol)
For $x = 0 To UBound($a_lv) - 1 Step 1
;~ For $Y = 0 To UBound($a_lv, 2) - 2 Step 1
For $Y = 0 To UBound($a_lv, 2) - 3 Step 1 ; ### MODIFIED ###
_GUICtrlListView_SetItemText($hWnd, $x, $a_lv[$x][$Y], $Y)
Next
_GUICtrlListView_SetItemParam($hWnd, $x, $a_lv[$x][$Y + 1]) ; write ItemParam ### NEW ###
For $Z = 1 To $i_selected[0]
;~ If $a_lv[$x][UBound($a_lv, 2) - 1] = $i_selected[$Z] Then
If $a_lv[$x][UBound($a_lv, 2) - 2] = $i_selected[$Z] Then ; ### MODIFIED ###
;~ If $a_lv[$x][UBound($a_lv, 2) - 1] = $iFocused Then
If $a_lv[$x][UBound($a_lv, 2) - 2] = $iFocused Then ; ### MODIFIED ###
_GUICtrlListView_SetItemSelected($hWnd, $x, True, True)
Else
_GUICtrlListView_SetItemSelected($hWnd, $x, True)
EndIf
ExitLoop
EndIf
Next
For $Z = 1 To $i_checked[0]
;~ If $a_lv[$x][UBound($a_lv, 2) - 1] = $i_checked[$Z] Then
If $a_lv[$x][UBound($a_lv, 2) - 2] = $i_checked[$Z] Then ; ### MODIFIED ###
_GUICtrlListView_SetItemChecked($hWnd, $x, True)
ExitLoop
EndIf
Next
Next
If (IsArray($vDescending)) Then
$vDescending[$iCol] = Not $b_desc
Else
$vDescending = Not $b_desc
EndIf
EndIf
EndFunc ;==>_GUICtrlListView_SimpleSort
|