What listbox control/plugin do you use?

You might want to share the correct file :slight_smile:

Sorry. Dropbox just changed their website and got me all confused.

Indeed, I have been using the Xojo listbox for over twenty years, cross platform. But with time, it became something else through subclassing.

Mac or crossplatform?

Recently @Thomas Tempelmann wrote a Listbox replacement using NSTableView.
Included with MBS Plugins.

Good to know. Unfortunately, it seems Julian is under Windows.

Hi Julian,

I use BensListBoxExtras for a long time now. I think it is great in <= Xojo 2016R3.
http://benandruby.com/bens_software/RBstuff.html

But since newpicture is no longer accepted in >= 2016R4 there is an error.
The code is partly encrypted, changing at the source s is not possible yet. but…
You can solve it very simple as you can see in the next topic.
See topic

[quote=325162:@Neil Burkholder]I use the Xojo listbox. It’s one of the things I love most about Xojo. If it doesn’t work the way you want just subclass it. This project shows a simple subclass that ‘fixes’ all the issues listed in the above cases. I didn’t fix the shift+pageup/pagedown, but it could be fixed the same way.

Edit: The attached project shows the ‘fixed’ listbox on the left and a standard listbox on the right.[/quote]

Not bad, its only 1.5 out of 5 fixes though :slight_smile: which isn’t bad for such little code in such little time. I understand that you could fix more of the problems with more code and I understand where you are coming from here, I had thrown together similar “fixes” when I found the problems in the first place. I then went onto fix the focus issue, which needed me to draw each cell myself, then I was thinking to myself, why am I taking this included control, throwing the majority of it away and coding the thing myself? Which is why I asked here if it has been done already.

I guess “I can’t use the in built in listbox control for a number of reasons.” in the OP was a little misleading, I guess I should have said “I don’t want to use the built in listbox control in it’s current state for a number of reasons.”.

[quote=325200:@Christian Schmitz]Mac or crossplatform?

Recently @Thomas Tempelmann wrote a Listbox replacement using NSTableView.
Included with MBS Plugins.[/quote]

Crossplatform, sorry for not specifying, though I will look into that when I come to macos testing, thanks.

[quote=325214:@Marc van Buel]Hi Julian,

I use BensListBoxExtras for a long time now. I think it is great in <= Xojo 2016R3.
http://benandruby.com/bens_software/RBstuff.html

But since newpicture is no longer accepted in >= 2016R4 there is an error.
The code is partly encrypted, changing at the source s is not possible yet. but…
You can solve it very simple as you can see in the next topic.
See topic [/quote]

Thanks Marc, I got it working, thats quite feature rich but it still exhibits the same problems as my feedbacks :frowning:

This thread has shown me a few things, for that I’m thankful, perhaps I will continue correcting the issues I see even if it takes make more hours than I care to spend on it as it seems there isn’t an off the shelf fix for the problems.

The way I look at the Xojo listbox is that it is a reasonably feature rich XPlatfrom foundation that one can build on to create a lot application specific XPlarform sophisticated list controls that would be MUCH more difficult (or impossible ) with the same code using fully native controls

That is why if Xojo ever introduces fully native list controls I hope they keep this one around and keep updating it too. It’s been an important tool in my X-Platform toolbox over the years.

It’s flexibility does stake some time to understand and master… but in the long run I have found it worthwhile to do that.

  • Karen

Can you explain?

I thought my example addressed all the issues listed in the 5 feedback cases.
I admit I simply addressed the focus issue by setting UseFocusRing = False. For my own listboxes I handle all the selection drawing because I like to use a gradient instead of plain blue. I use the paint events in almost all my listboxes.
The scroll bar issue was addressed by putting one line of code in the window resize event because the listbox doesn’t receive a resize event. If it must all be contained in the listbox subclass it could be accomplished using a timer.

If a control doesn’t do what I want I change it. You’re only limited by your creativity and time.

Here is an example from my program. No plugins or third party controls.

Thats a very nice form/control you have there, I can see a few issues with it, but that’s not what this thread is about.

1.5?

46695 - 1 was for the scrollbar fix
43705 - 0.5 was for the half fix, the focus ring isnt moving with the new selection, also try ctrl clicking 1,5,10 then shift+ctrl+clicking 15, 1 and 5 are cleared, but shouldn’t be.
43704 - Not fixed
46521 - Not fixed
46520 - Not fixed

Disabling a feature (focus ring) doesn’t really fix the problem :wink: Lots of people use keyboard input and the focus ring is a main part of that. I don’t know if your control properly manages that or not, but I can see a random dashed focus ring make an appearance in your image, where I guess you have two “focus rings” showing. I can only really tell these things by playing around with the control myself. I appreciate this can be fixed by coding it all up myself, but that isn’t what this thread is about.

Oh, that reminds me, I remember why I now said “I can’t use the in built in listbox control for a number of reasons.”. Your example suffers from <https://xojo.com/issue/47541> as well, I forgot about that one, too many problems to keep track of :wink:

I would recommend against encrypted code that hasn’t been updated in 7 years that doesn’t compile because of removed functions.

I know it’s a while later, but I decided to make a WinListBox that addresses the multiple selection issues.
WinListBox.xojo_binary_project

It should fix the following issues: (@ would you mind double checking me?)

  • Fixed by creating a method that can be called. Alternately a timer would need to be used in the subclass if the fix needs to be contained to the class.
  • Focus ring is now drawn manually. Option to use windows standard or Xojo standard focus ring.
  • Checked your steps above on VS listbox as well as another windows program I use (written in c++). My listbox acts like the standard windows list box by clearing the previous selection on Shift Click unless the previous selection was made by using Shift Click. (Correct me if I’m wrong.)
  • Fixed - Shift Home/End selects the correct lines. Also fixed Shift+PageUp and Shift + PageDown
  • Fixed this by drawing focus ring manually. Note that this issue only occurred in single selection mode. (Comment added to feedback.)
  • Fixed by manually drawing focus ring. Note that setting the listindex to -1 or clearing the selection, now removes the focus ring.
  • NOT FIXED - my subclass focus primarily on windows multiple selection and focus rings.

If you insist :slight_smile:

[quote=332816:@Neil Burkholder]@anon20074439 46694 - 1 was for the scrollbar fix

  • Fixed by creating a method that can be called. Alternately a timer would need to be used in the subclass if the fix needs to be contained to the class.[/quote]

Almost, in your example entry 40 is being hidden when you expand the window down when you are scrolled half way down the list.

Almost, try clicking on 5, shift + down until 10 is also selected then press down, 11 should be selected on its own.
or
Try clicking on 5, shift + down until 10 then press up, 9 should be selected
and similar in reverse going up first.

Almost, shift + down should select the number of entries that can fit on the screen. So in its initial state this should be 14 (scroll to the top and see how many entries can be seen)

Looks good

Xojo will need to look at that

“call RaiseEvent CellBackgroundPaint(g,row,column)” needs to be corrected in CellBackgroundPaint to account for the Boolean that is passed. You should act on its return, if its false then perform your draws, otherwise you will overdraw a users drawn control.

Looking pretty good there Neil, with a few more tweaks it will be passable :slight_smile:

Thanks. I will make the changes and post back.

Have a look now. Dropbox - WinListBox.xojo_binary_project - Simplify your life

This was a tough one to fix correctly. I added the following Computed Properties. This enabled me to calculate correctly.

  • HScrollBarVisible
  • VScrollBarVisible
  • VisibleRows

Easy Fix

Adding the above mentioned Computed Properties made it easy to fix this.

I fixed the call so the correct value is returned. In the standard Xojo listbox the focus ring is drawn over the user painted cells even if true is returned. Should this be altered? If so it wouldn’t be hard.

I’d be interested in having this checked out on other versions of windows as I only checked it on Windows 10.

Neil, People,

when you share a link from “www.dropbox.com”,replace the ending 0 with a 1 will make the download direct (instead of displaying a web interface to download the item).

If you find a 0 ending link, just copy the link, paste it and replace the ending 0 with 1 and you will download directly the item.

That said, thank you for the sharings.