Here's the IDL definition of the IUnboundHandler interface:
[
uuid(42FD4C01-3385-4BF4-9F42-E6E65104CF42),
pointer_default(unique)
]
interface IUnboundHandler : IUnknown
{
[propget, id(1), helpcontext(3001), helpstring("Gets the number of items.")] HRESULT ItemsCount( IDispatch* Source, [out, retval ] long* pVal );
[id(2), helpcontext(3002), helpstring("The source requires an item.")] HRESULT ReadItem( long Index, IDispatch* Source );
}
Here's the IDL definition of the UnboundHandler interface ( this interface is available starting from the version 11.1 ):
[
uuid(42FD4C01-3385-4BF4-9F42-E6E65104CF43),
]
dispinterface UnboundHandler
{
interface IUnboundHandler;
}
The following VB sample displays 1,000,000 items in virtual mode:
Implements EXLISTLibCtl.IUnboundHandler
Private Sub Form_Load()
With List1
.BeginUpdate
.Columns.Add("Index").FormatColumn = "value format `0`"
.VirtualMode = True
Set .UnboundHandler = Me
.EndUpdate
End With
End Sub
Private Property Get IUnboundHandler_ItemsCount(ByVal Source As Object) As Long
IUnboundHandler_ItemsCount = 1000000
End Property
Private Sub IUnboundHandler_ReadItem(ByVal Index As Long, ByVal Source As Object)
With Source.Items
.Caption(.VirtualToItem(Index), 0) = Index + 1
End With
End Sub
The following VB/NET sample displays 1,000,000 items in virtual mode:
Public Class Form1
Implements EXLISTLib.IUnboundHandler
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With AxList1
.BeginUpdate()
.Columns.Add("Index").FormatColumn = "value format `0`"
.VirtualMode = True
.UnboundHandler = Me
.EndUpdate()
End With
End Sub
Public ReadOnly Property ItemsCount(ByVal Source As Object) As Integer Implements EXLISTLib.IUnboundHandler.ItemsCount
Get
ItemsCount = 10000000
End Get
End Property
Public Sub ReadItem(ByVal Index As Integer, ByVal Source As Object) Implements EXLISTLib.IUnboundHandler.ReadItem
With Source.Items
.Caption(.VirtualToItem(Index), 0) = Index + 1
End With
End Sub
End Class
The following C# sample displays 1,000,000 items in virtual mode:
public partial class Form1 : Form, EXLISTLib.IUnboundHandler
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
axList1.BeginUpdate();
(axList1.Columns.Add("Index") as EXLISTLib.IColumn).FormatColumn = "value format `0`";
axList1.VirtualMode = true;
axList1.UnboundHandler = this;
axList1.EndUpdate();
}
public int get_ItemsCount(object Source)
{
return 1000000;
}
public void ReadItem(int Index, object Source)
{
(Source as EXLISTLib.IList).Items.set_Caption((Source as EXLISTLib.IList).Items.get_VirtualToItem(Index), 0, Index + 1);
}
}
The following VFP 9 sample displays 1,000,000 items in virtual mode:
with thisform.List1
.Columns.Add("Index").FormatColumn = "value format `0`"
.VirtualMode = .T.
.UnboundHandler = newobject('UnboundHandler', 'class1.prg')
endwith
where the class1.prg is:
define class UnboundHandler as session OLEPUBLIC
implements IUnboundHandler in "ExList.dll"
function IUnboundHandler_get_ItemsCount(Source)
return 1000000
endfunc
function IUnboundHandler_ReadItem(Index, Source)
With Source.Items
.Caption(.VirtualToItem(Index), 0) = Index + 1
EndWith
endfunc
implements UnboundHandler in "ExList.dll"
function UnboundHandler_get_ItemsCount(Source)
return this.IUnboundHandler_get_ItemsCount(Source)
endfunc
function UnboundHandler_ReadItem(Index, Source)
return this.IUnboundHandler_ReadItem(Index, Source)
endfunc
enddefine
The following VFP 7 and VFP 8 sample displays 1,000,000 items in virtual mode:
with thisform.List1
.Columns.Add("Index").FormatColumn = "value format `0`"
.VirtualMode = .T.
.UnboundHandler = newobject('UnboundHandler', 'class1.prg')
endwith
where the class1.prg is:
define class UnboundHandler as custom
implements IUnboundHandler in "ExList.dll"
function IUnboundHandler_get_ItemsCount(Source)
return 1000000
endfunc
function IUnboundHandler_ReadItem(Index, Source)
With Source.Items
.Caption(.VirtualToItem(Index), 0) = Index + 1
EndWith
endfunc
enddefine
The UnboundHandler / IUnboundHandler interface requires the following
properties and methods:


| Name | Description | |||
| ItemsCount | Gets the number of items. | |||
| ReadItem | The source requires an item. |