Page 1 of 2
[Done] Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 11:35 am
by zikitrake
This code of a virtual listicon works fine in PB6.21 (C Backend), but it only shows an empty list in PB6.30Beta1.
Any help is greatly appreciated!
Code: Select all
#ItemCount = 350000
#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
Global Dim Item.s(#ItemCount)
Enumeration
#window_0
#ListIcon_0
EndEnumeration
Procedure WinCallback(hwnd, msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*nmh.NMHDR = lParam
Select *nmh\code
Case #LVN_ODCACHEHINT
result = 0
Case #LVN_GETDISPINFO
*nmlvd.NMLVDISPINFO = lParam
If *nmlvd\item\mask & #LVIF_TEXT
*nmlvd\item\pszText = @Item(*nmlvd\item\iItem)
EndIf
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(#Window_0, 380, 150, 771, 336, "Putting strings in and out of a ListIcon Gadget", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
SetWindowCallback(@WinCallback())
ListIconGadget(#ListIcon_0, 10, 10, 750, 250, "", 725, #LVS_OWNERDATA)
SendMessage_(GadgetID(#ListIcon_0), #LVM_SETITEMCOUNT, #ItemCount, #LVSICF_NOINVALIDATEALL)
For i=0 To #ItemCount-1
Item(i) = Str(i) + " PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic" + #CRLF$
Next
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
[/size]
Thank you in advance!
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 1:19 pm
by Fred
Putting #LVS_OWNERDATA as flags isn't officially supported, you could try to set it with SetWindowLongPtr_() instead
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 1:26 pm
by jacdelad
Since this is the second report of this kind (using windows flags on gadget creation) there's maybe a chance to support this?
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 1:28 pm
by Fred
It hard to do because we can't add custom flags anymore as all flags values are already used by OS values. May be it could be exceptions for flags which can't be set later by SetWindowLongPtr()
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 2:22 pm
by spikey
Fred wrote: Thu Sep 04, 2025 1:28 pm
It hard to do because we can't add custom flags anymore as all flags values are already used by OS values.
Please pardon me if I'm showing my ignorance but couldn't you have a second optional parameter for the gadget commands? Rename the existing one 'PBFlags', call the new one 'OSFlags' and pass through the contents directly to the underlying API calls without intervention on an 'at your own risk' basis. You'd need to be able to support '#PB_Ignore' as a parameter to 'PBFlags' in the event that no PB flags require setting.
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 2:53 pm
by Piero
spikey wrote: Thu Sep 04, 2025 2:22 pmPlease pardon me if I'm showing my ignorance but couldn't you have a second optional parameter for the gadget commands? Rename the existing one 'PBFlags', call the new one 'OSFlags' and pass through the contents directly to the underlying API calls without intervention on an 'at your own risk' basis. You'd need to be able to support '#PB_Ignore' as a parameter to 'PBFlags' in the event that no PB flags require setting.
Huh? I'm often worried to get misunderstood because of my horrible english, but I always get relieved when reading windoze stuff on this forum; it always beats me by far (this was mostly a test to see how AI translators work

)
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 3:08 pm
by spikey
Piero wrote: Thu Sep 04, 2025 2:53 pm
Huh?
Assuming
I've understood Fred correctly, there's a space issue in the bitmask for the flag values. There's only a maximum of 32-bits available (because it's a 32-bit Windows implementation feature migrated to the 64-bit environment). There's a competition for space between flags needed by PB for creation and by the OS.
By separating out the two values into different parameters, you reduce competition problems.
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 3:14 pm
by Piero
I will be """happy""" if win ppl, because of some update """problems""", will consider to try to make more "standard" PB code in the future...
More for them than for me
Edit/PS: Darn Apple; a Mac VM on Win is not very easy stuff… (would help PB bug reporting)
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 3:48 pm
by NicTheQuick
Since Purebasic can be compiled for Linux, Windows, and Mac, I would advise against designing commands in such a way that they allow OS-specific constants. This will only lead to code that is no longer cross-platform.
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 4:00 pm
by Little John
NicTheQuick wrote: Thu Sep 04, 2025 3:48 pm
Since Purebasic can be compiled for Linux, Windows, and Mac, I would advise against designing commands in such a way that they allow OS-specific constants. This will only lead to code that is no longer cross-platform.
+ 1
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Thu Sep 04, 2025 6:10 pm
by Piero
To be sincere, I feel a bit sad/guilty, because I posted """great stuff""" that was (at least easily) only possible on Mac (like fuzzy autocomplete).
I SOOO hoped some win guru could EASILY replicate my sh*t…

Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Fri Sep 05, 2025 5:19 am
by jacdelad
NicTheQuick wrote: Thu Sep 04, 2025 3:48 pm
Since Purebasic can be compiled for Linux, Windows, and Mac, I would advise against designing commands in such a way that they allow OS-specific constants. This will only lead to code that is no longer cross-platform.
There are some windows specific flags which can't be set afterwards with SetWindowLongPtr. It would be great to be able to use them without having to go through the usage of APIs (which is still an option, sure).
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Fri Sep 05, 2025 7:52 am
by zikitrake
Oh my goodness, what a mess
Thanks, Fred and company... I tried using:
Code: Select all
SetWindowLongPtr_(GadgetID(#ListIcon_0),#GWL_STYLE,GetWindowLongPtr_(GadgetID(#ListIcon_0),#GWL_STYLE) | #LVS_OWNERDATA)
But I don't think I'm doing it right, because now it doesn't work in either PB6.21 or PB6.30beta1
Code: Select all
#ItemCount = 350000
#LVSICF_NOINVALIDATEALL = 1
#LVN_ODCACHEHINT = #LVN_FIRST - 13
Global Dim Item.s(#ItemCount)
Enumeration
#window_0
#ListIcon_0
EndEnumeration
Procedure WinCallback(hwnd, msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*nmh.NMHDR = lParam
Select *nmh\code
Case #LVN_ODCACHEHINT
result = 0
Case #LVN_GETDISPINFO
*nmlvd.NMLVDISPINFO = lParam
If *nmlvd\item\mask & #LVIF_TEXT
*nmlvd\item\pszText = @Item(*nmlvd\item\iItem)
EndIf
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(#Window_0, 380, 150, 771, 336, "Putting strings in and out of a ListIcon Gadget", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
SetWindowCallback(@WinCallback())
ListIconGadget(#ListIcon_0, 10, 10, 750, 250, "", 725)
SendMessage_(GadgetID(#ListIcon_0), #LVM_SETITEMCOUNT, #ItemCount, #LVSICF_NOINVALIDATEALL)
SetWindowLongPtr_(GadgetID(#ListIcon_0),#GWL_STYLE,GetWindowLongPtr_(GadgetID(#ListIcon_0),#GWL_STYLE) | #LVS_OWNERDATA)
For i=0 To #ItemCount-1
Item(i) = Str(i) + " PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic" + #CRLF$
Next
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Re: Virtual list works in 6.21 but not int 6.30beta1
Posted: Fri Sep 05, 2025 9:16 am
by Fred
According to MSDN, you can't set after creation. I will revert these changes for next beta.
Re: [Done] Virtual list works in 6.21 but not int 6.30beta1
Posted: Sat Sep 06, 2025 1:13 pm
by Fred
Fixed.