I have a multi-column listbox where the user can sort the contents by clicking a header cell in the usual way. Having done this, the user may then click on a button that loads entirely new content into the listbox. This new content is perforce unsorted, but the header cell still indicates that the content is sorted. How can I reset the header cell back to the unsorted appearance?
should be
listbox1.SortedColumn = -1
What about
Listbox1.HeadingIndex=-1
[quote=388150:@Kuzey Atici]What about
Listbox1.HeadingIndex=-1
per the LangRef
Ahh…that’s what I get for using 2015
[quote=388149:@Dave S]should be
listbox1.SortedColumn = -1
[/quote]
I tried this before posting; it appeared to have no effect.
Forgot to mention that I’m using 2018r1, producing a 64 bit executable running under macOS Mavericks.
I suppose a supplementary question might be, are the appearance of the header cell highlight and sort-direction arrow caused by setting SortedColumn and ColumnSortDirection, or are they set once Sort is called?
Maybe:
LB.SortedColumn = -1
LB.HasHeading = False
LB.HasHeading = True
[quote=388196:@Emile Schwarz]Maybe:
LB.SortedColumn = -1
LB.HasHeading = False
LB.HasHeading = True
[/quote]
Yes, that appears to work - thanks. Not quite intuitive, however.
I can also set a column to appear sorted without the sort occurring by suppressing the sort via the HeaderPressed event as I’ll do teh sort when getting the data from the database.
Tim: that answer can be found in this forum. I do not say that and give directly the answer because I do not know what search string to use / my project with the solution was loaded
Doing the sort with the Databse ? Do that in the Sort Event and do not let Xojo do it on its own ? Nice idea.