Directory Listing

I’m using a Listbox to hold all the filenames in a specific folder. I got that part working. Now I want to be able to grab the right side of the listbox and change it’s width by dragging the mouse. Usually a Slider component is used for this but the Slider I see is a different kind of Slider.

Any help appreciated on how to dynamically change the width of the listbox.

Thank you…

You need a grabbar next to the listbox. I use imSplitter for the purpose.

Hmmm…yeah…I don’t see that component…???

Download it from the github link. Its not part of Xojo

OK thanks…

Dont forget you can add horizontal scrollbars to the listbox so that the contents can be viewed without needing to make it wider

Yes and I will be doing that.

IIRC there is an example with the distribution, so I’d look at that first to see how to use it.

Yeah, I’m reading the github instructions:

Drag imSplitter.xojo_binary_code to your projects folder (or copy/paste it from the example project)

I guess I’m not copying the file to the right place because I don’t see any “Project Controls” section in my Library. I guess I don’t know where my projects folder is ?

Drop it on the navigation area in your project in the IDE - left most in the window.

Scroll down the library pane to see that.

I got it…and now I see it in the Project Controls…thank you very much…

Looks like I need to put my listbox inside a container?

Don’t think that’s a requirement. What else d’ye have in the window besides the listbox?

Right now just the listbox.

I got it to work using splitterMoved.

Thanks for all the help.

You can also compute the largest string (stored in a Row) and enlarge the ListBox | Window.

Is there a predefined method for that or do I have to manually figure it out?

You create a very small Picture;
You set the Font Name / Font Size the same as your ListBox,
You scan all Columns Contents and asn the Picture.Graphics what width it takes and keep the largest value,
until the last Column/Row.

Of course, it takes time if you have millions of row / hundred of Columns / j-you use an OnDemand display Canvas.

Is it clear enough ?