color the header of a listbox

I have code in the cell background paint event to color a row
But the header is always black and white.

How can you override the painting of a listbox header?

Not that I am aware of. I’ve used Dave S’s ListBox header class in the past when I need to do that.

Downloaded that, it’s a start, but lacks (as it stands) the ability to resize the columns.
Could take a bit of work to add that, so I’ll keep looking for the moment.
(Axel posted something similar, but when I try to unzip the LB_Header2.zip file, all I get is another type of zip file. LB_Header2.zip.cpgz)

Jeff that sounds like an issue with the dropbox transfer. If you get me the link (https://xojo.io/…) I can probably fix it.

https://xojo.io/2232dab67b50

2232dab67b50 is the bit on the end.

The link download a zip.
The zip is in fact an html file.

Delete the zip extension and place an html extension instead.

Double click that html file and click in the download link.

Now, the Header string text color can be set.

The import csv does not works at all (either with double quotes around each field or not). I was just curious.

Thanks.
Got it now, its no better in the resize columns department.
Drawing something in a canvas above a listbox is relatively straightforward

What I’ve used when I need much more control than a standard Listbox is the DataView grid from piDogSoftware

FWIW I’ve fixed the file :slight_smile:

I’ve run into the same desire to have a listbox with a customized header to match the look and feel of the rest of the application.
I ended up rolling my own container control that utilizes a canvas as a header that supports resizing and sorting columns.

https://www.dropbox.com/s/s0zottpq7i19dyr/Custom%20Header%20Listbox.xojo_binary_project.zip?dl=0

Keep in mind that this code was not originally written to be a standalone control that can directly replace the base Xojo listbox, so you will have to do some modification in order for it to suite your needs.

Hopefully it points in you the right direction, however.

Edit: updated link

Jared, all,

dropbox links ends with ?dl=0 displays a web page that allows you to click to download the file (and something else ?).

If you simply share a dropbox link who ends with ?dl=1, the file download silently NOT OPENING ANY WEB PAGE.

As always, thank you for sharing information.

Hello, on behalf of this subject I found this nice component that allows customisation of the listbox headers.
http://simcarsoftware.com/onewebmedia/ListBoxHeading.zip

Regards,

/Dirk

That reference is to my website.

Please note that all references in all the downloads from there are not API2 yet!

Simon.

@Simon Berridge . Thanks for the remark. Actually at first I would have liked to post a link to this particular component , but since I appreciate your work a lot, I took the liberty to give some attention to your other components also.

Anyway for the Listboxheading as well for the MagicListbox, they compile well under Xoja 19R3.

/Dirk

@Simon Berridge . Nice, very handy. Thanks for making it, and your other works, available.

Thanks all.

Simon.

[quote=467317:@Simon Berridge]That reference is to my website.

Please note that all references in all the downloads from there are not API2 yet!

Simon.[/quote]
Does ListBoxHeading work with Windows targets?

It works on Win10 here. Unfortunately has a bit of a visual lag when resizing a column and waiting for the listbox resize to catch up.

I think it likely that you have a lot going on for that lag to show up. I don’t remember exactly where I placed the resizing code but you could check out the order of calling.

Actually I was seeing this in your demo, running a windows debug session on a Mac. It sped up slightly with a few pragmas in the header’s paint event. I noticed that the header’s MouseDown event runs significantly slower on the Win10 VM, but I suspect that’s baked into the framework.

Will keep tinkering as time allows…