Listview gadget scroll bar and item count

Windows specific forum
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Listview gadget scroll bar and item count

Post by harkon »

I think this may qualify as a bug, but I may be missing something so ...

Referring to the following code;

Code: Select all

    Global Window_0
    Global ListView_0

    Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 1000)
      Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
      ListView_0 = ListViewGadget(#PB_Any, 10, 10, 250, 970)
    EndProcedure

    Procedure Window_0_Events(event)
      Select event
        Case #PB_Event_CloseWindow
          ProcedureReturn #False

        Case #PB_Event_Menu
          Select EventMenu()
          EndSelect

        Case #PB_Event_Gadget
          Select EventGadget()
          EndSelect
      EndSelect
      ProcedureReturn #True
    EndProcedure

    OpenWindow_0()

    For x.i=0 To 65609
      AddGadgetItem(ListView_0,-1,Str(x))
    Next x

    Repeat
      event = WaitWindowEvent()
    Until Window_0_Events(event) = #False

    End


Sorry for the Q&D copy paste.

Running the program as is, loads items in the listview 0 to 65609. When you grab the vertical scoll bar and drag it down, as you get close to the bottom, the items list starts over. If you make x a maximum of 65608 the it acts as is expected.
This occurs in both the x86 and x64 versions of 5.24LTS under Windows 7 x64. This does not appear in 5.20LTS under XP. I am doing some further investigation. This also does not appear in 5.31 under Linux.

Further testing reveals it does happen with 5.20LTS under Win 7 x64
Also happens with 5.31 under Win7 x64
Also happens with 4.61 under Win7 x64

I'd guess that this is somehow a Win7 issue, may or may not be restricted to x64 versions of Windows.

I did a very similar program in VB6 and the problem does not appear using VB6

Again, this does not appear to be a x86 / x64 development environment issue, but rather a PB issue in how it interfaces with Win7 x64. I do not have a Win7 x86 machine I can test on. I also do not have many other programming languages installed to do further testing in other dev environments to further try to nail this down.
Missed it by that much!!
HK
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Listview gadget scroll bar and item count

Post by IdeasVacuum »

Confirmed on Win7 32bit.

Since the ListView Gadget is a PB customised gadget, it would indeed be a PB limitation.

....Fortunately, if you use a ListIcon Gadget, the fault does not occur (tested to 99999).
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Fred
Administrator
Administrator
Posts: 18226
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Listview gadget scroll bar and item count

Post by Fred »

PureBasic uses the regular "ListBox" WinAPI gadget which is limited to 65536 items. I will update the doc to reflect this, if you want to put more item in a gadget, you will have to use a ListIconGadget(). Also, putting such a lot of items in a control makes the user choice very very difficult, so it's probably better to rethink the GUI to avoid this.
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: Listview gadget scroll bar and item count

Post by harkon »

Thanks Fred. The GUI isn't really a problem. The user starts to type in a field and the correct item gets selected. The gadget is actually capable of more items, it's just the scrollbar that seems out of whack. Generally the scrollbar is mostly useless anyway as the slightest movement results in a huge jump. This was something I discovered when testing after a new list update. The program is actually for an internal price list. The bug has actually been present since about February of this year (out items counts got larger), however the bug was still not yet discovered in the field. Tells me they don't use the scrollbar anyway, and they really don't need it. I will see about changing the gadget. As I use an autocomplete routine and an autoselect routine, this may be less than trivial, but may be for the best in the long haul.

Thanks for your help.
Missed it by that much!!
HK
Fred
Administrator
Administrator
Posts: 18226
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Listview gadget scroll bar and item count

Post by Fred »

If your only issue is with the scrollbar, you can may be hide it and it will do the trick (with SetWindowLong_() you can modify the style)
Post Reply