Bon-Jour
Seulement Windows
ajouter un nombre illimité d'élément sur ListIconGadget Tréééés rapidement.
Code : Tout sélectionner
;By Celtic88 (c) 2017
;More info about Virtual List-View:https://msdn.microsoft.com/en-us/library/windows/desktop/bb774735(v=vs.85).aspx#Virtual_ListView_Style
Procedure.s RandomString(len=10)
Protected Ranstr.s,oklm
For oklm=1 To len
Ranstr + Chr(Random(90,64))
Next
ProcedureReturn Ranstr
EndProcedure
Global Dim ItemInfo.s(1,100000)
Global LvHwnd
Procedure WinCallback(hWnd, uMsg, WParam, LParam)
Select uMsg
Case #WM_NOTIFY
Protected *tNMHDR.NMHDR = LParam
Select *tNMHDR\hwndFrom
Case LvHwnd
Select *tNMHDR\code
Case #LVN_GETDISPINFO
Protected *tNMLVDISPINFO.NMLVDISPINFO = LParam
With *tNMLVDISPINFO
If \item\mask & #LVIF_TEXT
\item\pszText = @ItemInfo(\item\iSubItem,\item\iItem)
\item\cchTextMax = Len(ItemInfo(\item\iSubItem,\item\iItem))
EndIf
EndWith
EndSelect
EndSelect
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0, 100, 100, 500, 600, "Test Virtual List-View", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0, 5, 5, 490, 590, "Nom", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection|#LVS_OWNERDATA)
LvHwnd = GadgetID(0)
AddGadgetColumn(0, 1, "Adresse", 250)
SetWindowCallback(@WinCallback(),0)
Debug "preparing list.."
For u=0 To 100000
For ii=0 To 1
ItemInfo(ii,u) = Str(u) + " " + RandomString(5)
Next
Next
Debug "End preparing list.."
SendMessage_( LvHwnd, #LVM_SETITEMCOUNT, 100000+1, 0 )
Repeat
Evenement = WaitWindowEvent()
Until Evenement = #PB_Event_CloseWindow
EndIf
amusez vous bien