a number of years ago I wrote a custom Listbox Header Control to provide move “control” over how the header looked, and reacted.
It automatically reacted based on changes to its child listbox.
Recently while creating my Tadpole SQLite Manager, I needed to improve this control.
A new version is now available for free (however I won’t turn away donations )
- Control now scrolls left/right in synch with the child listbox
- Columns can be resized (not EXACTLY like the native listbox, but as close in function as I could make it)
- Header now reacts to ColumnClick command with embedded up/down arrow to indicate sort direction
Listbox Header Control
This control SHOULD work on all platforms (well at least macOS/Win/Linux), it is 100% Xojo with no target specific code or declares
Dave, I think I may have uncovered a possible problem. When I click on the header for the first column, I get the sort indicator. Clicking on it again does not indicate a reversal of the sort order. The other columns indicate correctly.
[quote=356312:@Dale Arends]Dave, I think I may have uncovered a possible problem. When I click on the header for the first column, I get the sort indicator. Clicking on it again does not indicate a reversal of the sort order. The other columns indicate correctly.
really? the first column only toggles once, while the others toggle correctly?
I will look into that as soon as I can… the next few days I am involved in helping my wife plan for a memorial, as her father passed a few weeks ago…
I think the problem is:
If value=zSortedColumn And value>0 Then
I changed to
If value=zSortedColumn And value>=0 Then
in Properties - SortedColumn - Set, and it works
Thanks… I was sure it was something easy… just hadn’t had time to look at it…
I will make sure it gets changed and updated on the server as soon as I can
Hello Dave, I’ve been playing with your header project (thank you BTW) and for the life of me I can’t seem to add rows to the Listbox1…
I’ve tried the following in several places (most recently right after the line: me.DeleteAllRows )
the control acts like there’s three rows there, I can move the selected row up and down that many, but no data shows…
If I add a ListBox2 and add the same code (editing for Listbox2.) and it does add the rows…
I’m sure it’s my inexperience, but thoughts?
Well all I can tell you based on what you said… is that my control has NO effect on the Listbox itself… it simply follows along with changes in width etc… but could care less about what is in the rows.
Did you make any changes to any of the Listbox events , like the CellBackground and CellText paint events?
Not initially, but did try once on the CellTextPaint to try to change the fontcolor in case it was white-on-white for some reason…
I am using 2018r1.1, if that’s any help/concern. (but did try 2016r3 too for grins).
Playing around some more, if i comment out the ‘Return true’ line in CellTextPaint, then the data shows, (but the header won’t sort).
As to 2018… I don’t know as I had to stop for a while at 2016.
Personally I almost always leave Return True in CellTextPaint (which says that “I” will draw the text)
and put custom code in CellBackGroundPaint to handle everything that should appear
I hear you on the 2018 (messes up my apps that print, resolution is poor)… the lb_header example I’m using doesn’t have an event handler for CellBackGroundPaint on the Listbox1 control, should it? also I’m on windows BTW.