ccInsertItem

Syntax

Pointer = ccInsertItem(LVSORT:_LVSORT)

The Type definition for '_LVSORT' is
TYPE _LVSORT
DEF Win:Window
DEF LV:Uint
DEF Column:Uint
DEF SortingOrder:Int
DEF pszText:Pointer
DEF iItem:Uint
DEF lParam:Uint
ENDTYPE

Description

Insert an Item into a 'LISTVIEW' control and prepare the control to be sortable.
Additionally it's returns the pointer to the sorting callback function, which is integrated into the assembly.

Parameters

LVSORT - _LVSORT structure.

Win - Dialog or Window variable the 'Listview' is accommodated in.
LV - The 'Listview' identifier.
Column - The column -usually clicked- to be sorted. (Not relevant see 'LVSort' Callback)
SortingOrder (boolean)- (Not relevant see 'LVSort' Callback)
True = Ascending
False = Descending
pszText - The Item have to be inserted
iItem - The Position of the Item in the ListView
lParam - The unique identifier for the Item

Return value

The Pointer to 'LVSort' Callback function.

Remarks

The function Insert an Item into a ListView control and set 'LVITEM.lParam' to '_LVSORT.lParam'.
This is a unique identifier for the Item windows use it by the quick sort alg.
It can be set to the same running # of the item position in the ListView.
Sample:
SUB FillList
DEF Count:Uint
DEF Temp:String
LVSORT.Win = Dialog1
LVSORT.LV = LISTVIEW
FOR Count = 0 TO MAX
Temp = USING("0########",Max - Count)
LVSORT.iItem = Count
LVSORT.lParam = Count
LVSORT.pszText = Temp
CallBack = ccInsertItem(LVSORT)
CONTROLCMD Dialog1,LISTVIEW,@LVSETTEXT,Count,1,USING("0########",RND(Max))
NEXT Count

Example usage

See above.

See ListViewSortCallback_DEMO.eba
See 'LVSort' CallBack function.