Page 1 of 1

Loading faster ListIcon like AddGadgetItem() [Resolved]

Posted: Mon Aug 17, 2015 10:19 am
by Kwai chang caine
Hello at all

I have take the code of RASHAD (Virtual ListIcon) for loading quickly a ListIcon
http://www.purebasic.fr/english/viewtop ... 05#p403305

User_Russian help me yesterday 8) for use a structured array with this code
But this time, i need to use like RASHAD a simple array, with CHR(10) separator like the AddgadgetItem() for the ListIconGadget

I don't understand why Debug PeekS(*pnmlvdi\item\pszText) return good "Hello" and "I'm" and "Kcc" then in the ListIcon i have just the first letter of "Hello" :|

Code: Select all

#ItemCount = 350000

#LVSICF_NOINVALIDATEALL = 1 
#LVN_ODCACHEHINT = #LVN_FIRST - 13

Global Dim myItems.s(#ItemCount)

Procedure WinCallback(hwnd, msg, wParam, lParam) 
 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))
       *pnmlvdi\item\pszText = @Field$
       Debug PeekS(*pnmlvdi\item\pszText)
     EndIf 
     ;
   EndSelect 
 EndSelect 
 ProcedureReturn result 
EndProcedure 
;
If OpenWindow(0, 0, 0, 300, 430, "Virtual ListIconGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
 SetWindowCallback(@WinCallback()) 
 Licon = ListIconGadget(0,5,5,290,390,"1",100,#LVS_OWNERDATA)
 
 SendMessage_(Licon, #LVM_SETITEMCOUNT, #ItemCount, #LVSICF_NOINVALIDATEALL) 
 AddGadgetColumn(0,2,"2",100) 
 AddGadgetColumn(0,3,"3",100) 

 For i=0 To #ItemCount 
  myItems(i) = "Hello" + Chr(10) + "i'm"  + Chr(10) + "KCC"
 Next i 
 
 Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
 
EndIf
Have a good day

Re: Loading faster ListIcon like AddGadgetItem()

Posted: Mon Aug 17, 2015 5:01 pm
by Thunder93
PokeS() it is easier and allows for smooth reading afterwards in both ASCII and Unicode modes.

Re: Loading faster ListIcon like AddGadgetItem()

Posted: Mon Aug 17, 2015 5:07 pm
by Kwai chang caine
Hello THUNDER93 :D

Easier and KCC is not compatible :oops:

I have not understand where i do put the Poke :cry:

Re: Loading faster ListIcon like AddGadgetItem()

Posted: Mon Aug 17, 2015 5:25 pm
by Thunder93
Hey KCC.

In the callback procedure, you have the following;

Code: Select all

*pnmlvdi\item\pszText = @Field$
REM that line and insert on a new line;

Code: Select all

PokeS(*pnmlvdi\item\pszText, Field$)

Re: Loading faster ListIcon like AddGadgetItem()

Posted: Mon Aug 17, 2015 5:39 pm
by Kwai chang caine
Waouuuh !!
You are too strong !!!


Just a line for 3 hours of thinking :cry:
Never i found without you

I wish you a very good day...and again more ....be crazy :lol:

I wish you a very good Week !!! :D

Re: Loading faster ListIcon like AddGadgetItem() [Resolved]

Posted: Mon Aug 17, 2015 5:42 pm
by Thunder93
You too. :)