Thanks to RASHAD and NETMAESTRO, i have now a fast virtual listicon, able to give the XY and text value of the cell clicked
http://www.purebasic.fr/english/viewtop ... 96#p494696
Code: Select all
Enumeration
#Window
#WinEntrer
#ListIcon
#StrEntrer
EndEnumeration
Structure ListIcon
PosX.i
PosY.i
ColSelec.i
LigneSelec.i
LargeurColonne.i
HauteurColonne.i
Oldlist.l
EndStructure
#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
#LVM_SUBITEMHITTEST = #LVM_FIRST + 57
#MaxLignes = 350000
Global Grid.ListIcon
Global Dim myItems.s(#MaxLignes)
Procedure WinCallback(hwnd, msg, wParam, lParam) ; RASHAD
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*pnmh.NMHDR = lParam
Select *pnmh\code
Case #LVN_ODCACHEHINT
result = 0
Case #LVN_GETDISPINFO
*pnmlvdi.NMLVDISPINFO = lParam
If *pnmlvdi\item\mask & #LVIF_TEXT
Field$ = StringField(PeekS(@myItems(*pnmlvdi\item\iItem)), *pnmlvdi\item\iSubItem + 1, Chr(10))
PokeS(*pnmlvdi\item\pszText, Field$)
EndIf
;
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
Procedure SubClass_LV(hwnd, msg, wparam, lparam) ; NETMAESTRO
Result = CallWindowProc_(Grid\Oldlist, hwnd, msg, wparam, lparam)
Select msg
Case #WM_LBUTTONDOWN
HitInfo.LVHITTESTINFO
Hitinfo\pt\x = WindowMouseX(#Window)
HitInfo\pt\y = WindowMouseY(#Window)
SendMessage_(GadgetID(#ListIcon), #LVM_SUBITEMHITTEST, 0, @HitInfo)
Debug hitinfo\iItem
Debug hitinfo\iSubItem
Debug StringField(myItems(hitinfo\iItem),hitinfo\iSubItem+1,Chr(10))
EndSelect
ProcedureReturn Result
EndProcedure
OpenWindow(#Window, 0, 0, 640, 480, "ListIcon Gadget Mischief: Edit Selected Item", $CF0001)
ListIconGadget(#ListIcon, 0, 0, 640, 480, "", 0, #PB_ListIcon_GridLines|#LVS_OWNERDATA)
AddGadgetColumn(#ListIcon, 1, "Column 1", 210)
AddGadgetColumn(#ListIcon, 2, "Column 2", 210)
AddGadgetColumn(#ListIcon, 3, "Column 3", 215)
SetWindowCallback(@WinCallback())
SendMessage_(GadgetID(#ListIcon), #LVM_SETITEMCOUNT, #MaxLignes, #LVSICF_NOINVALIDATEALL) ; RASHAD
Grid\Oldlist = SetWindowLong_(GadgetID(#ListIcon), #GWL_WNDPROC, @SubClass_LV()) ; NETMAESTRO
For i=0 To #MaxLignes
myItems(i) = Trim(Str(i)) + Chr(10) + "Hello" + Chr(10) + "i'm" + Chr(10) + "KCC " + Trim(Str(i))
Next i
Repeat
ev = WaitWindowEvent()
Until ev = #PB_Event_CloseWindow
I have use SetItemColor but obviously that not works because it's a virtual ListIcon and she is managed only by the CallBack with the #Notify message
Worst... when i use SetItemColor, i believe the Subclassing of NETMAESTRO is called, and it's a nice whorehouse
Have you a way for changing the background, or text color of the code above ?
Have a good day