--- In rapidq@yahoogroups.com, "carlt_1" <carlt_1@...> wrote:
>
> I've recently started using the patched LIBS to fix the memory leaks
> in my programs.
>
> However I seem to have found a new bug which is giving me a headache.
> I've written several Routines to sort the items in my QListView who
> worked before.
>
> Now the SwapItem command always swaps the selected Item with the first one.
>
> List1.SwapItem (2,3) -> swaps Item 2 with Item 0.
> List1.SwapItem (12,5) -> swaps Item 12 with Item 0.
>
> Does anyone know how to fix/work around this?
>
> I have sometimes several hundred Items and not being able to sort them
> can be a real pain.
>
> Any help would be appreciated.
>
> CarlT
>
did you try SortType?
' Extended ListView, some are only cosmetic extensions, not sure how to
' detect if the checkbox was checked or not...
$TYPECHECK ON
$INCLUDE <RAPIDQ.INC>
declare Sub MyClick(column%)
CONST LVM_FIRST = &H1000
CONST LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
CONST LVEX_GRIDLINES = 1
CONST LVEX_SUBITEMIMAGES = 2
CONST LVEX_CHECKBOXES = 4
CONST LVEX_TRACKSELECT = 8
CONST LVEX_HEADERDRAGDROP = 16
CONST LVEX_FULLROWSELECT = 32
CONST LVEX_ONECLICKACTIVATE = 64
CONST LVEX_TWOCLICKACTIVATE = 128
CREATE Form AS QForm
Center
Caption = "Extended ListView"
Height = 330
Width = 525
CREATE ListView AS QListView
ColumnClick = True
Width = Form.ClientWidth
Height = Form.ClientHeight
ViewStyle = vsReport
AddColumns "first","second","third","last"
Column(0).Width = 200
AddItems "xxx", "bbb", "aaa", "Hello", "World"
AddSubItem 0, "100"
AddSubItem 0, "Yes"
AddSubItem 0, "???"
AddSubItem 1, "asdf"
AddSubItem 1, "sdfs"
AddSubItem 1, "dfgdfg"
OnColumnClick = myClick
END CREATE
END CREATE
Form.ShowModal
Sub MyClick(column%)
defint t
if t = 0 THEN t = 2 else t = 0
ListView.SortType = t
End sub