Listbox - First row returns -1

Are you saying “I can’t get it turned off”?

If yes, that’s just another inconsistency not addressed yet.

I do not say that.

So I don’t know what you’re saying. :smiley:

When you click in a Column Header - to sort it - Xojo add a small icon in it.

Using the provided trick, you can remove it (if you no more need it).

Well, that’s not a problem. I was expecting some problem.

I have enough on my own, please keep yours away from me ! :innocent:

I kill my problems. They won’t join forces with yours. :laughing:

1 Like

You haven’t understood that these are two entirely different features of the listbox. In my app, in one listbox the user can sort (e.g. by date) by clicking in a header. This is not a heirarchical listbox. I haven’t implemented drag-reordering and don’t want to. In another listbox there is no header and I have implemented drag reordering as it makes sense in that context. This listbox is heirachical so sorting it makes no sense. Moving rows around by dragging, does, because of what the rows represent.

Nope. Now I know. The bad naming of the AllowDragRowReordering as AllowRowReordering is a problem.

I’m not not talking about your app, your choices or workarounds, etc, just about the Xojo design, inconsistencies, etc.

1 Like

And I was using my app as an example of the difference between these two features, and why it’s important.

1 Like

Oh, that was already clarified here

While that is true in your usage case, that is not always the case for hierarchical list boxes. I have used sortable hierarchical listboxes.

-Karen

SelectionChanged event show me the rows from 0 to x
(Xojo 2021 r3.1)

Sub SelectionChanged() Handles SelectionChanged
  System.DebugLog Me.SelectedRowIndex.ToString()
End Sub

usually is -1 = DesktopListbox.NoSelection
System.DebugLog Str(DesktopListbox.NoSelection)

My code should disable the arrow also.

That (stupid) idea comes to mind yesterday afternoon:

Vince: did you add at least one Row to your Listbox ?
If not, -1 is the correct answer.

I have tried it with one row and nearly 100 rows. The “SelectedRowIndex” is always wrong. If you remember the article that I wrote for xDev on "Filemaker like checkboxes, I compiled that project under the current XOJO and it is obviously getting the correct row index. That project is still using the old listbox. I’m thinking that there is an inconsistency in the new DesktopListbox (Bug! maybe). Just in case I created an issue for it.

I guess this is your case: #72848 - Desktoplistbox almost always returns the wrong “SelectedRowIndex” number

but is missing a sample project, did you share it privately?

I see your Issue, but it appears to be content-free. No project, no description, no platform or Xojo version.

Nul points, M’sieu.

1 Like

The data in the project is confidential.

@TimStreater,

The listbox contains my confidential invoice information so I didn’t feel comfortable sharing it. I’m on a Mac, OSX version 13.4 and using XOJO version2023.1.1.