Hi guys, how do i select the entire row when i click on a cell in a listbox?
if the selection type is set to single then it should already be done for you unless you['ve done something to make that not work as intended
sometimes that can happen if you intercept the mouse down & mouse up events etc and don’t let the listbox handle them as it normally would
Return error in .ListIndex
Ok, and what is the property of the ListBox that tells me the selection of the whole row?
what do you mean ?
Listened can be negative which your code would have to check but without knowing what your code looks like I’d be guessing to offer any help
fwiw in the listbox you cant do anything BUT select entire rows
you can select one row, many contiguous rows, or a discontiguous set of rows
but its always whole rows IF you’re using the built in listbox that comes with Xojo
In CellPressed i write:
For i As Integer = 0 To ListBoxInventario.LastRowIndex
ListBoxInventario.RowSelectedAt(i) = True
but select onli first cell !!
have you got code in other events of this listbox ?
like the various paint events ?
My code is wrong, i select cells. entire row.
if you only see one row selected and you expect more then its possible you have the selection type set to single row
No, i have selected MULTIPLE, but wh
e i select a cell, not select entire row, but only a cell clicked.
If your cell click code does NOT return true Xojo will do its normal processing of the click which is to basically undo your code and select the one row
The documentation is your friend
I don’t understand where I should return the boolean value True. In PaintCellBackGround I wrote return True, but it doesn’t change anything. I tried to set it also in CellPressed returb true but still nothing changes.
…and more: I read documentation, i used Xojo 2022 R.1.1. Bacause in ListBox documentation i read ListBox (deprecated) ??? I use this control / Library in Xojo. I confused.
Is that listbox hierarchical, and is that on Windows?
Yes, it could be confusing.
If you drag a listbox and you use the Inspector to see what the super says, if you see DesktopListbox then it is the new Listbox:
If instead of DesktopListbox it says only Listbox, then is the deprecated listbox.
Back on topic: didn’t you add some code to the paint events to change the background or just paint a cell when you click on it? Maybe that is causing you problems on what you want now (select entire row)?
On Windows, a selection is not the entire row of a multi-column Listbox the way it is on macOS.
One has to write their own “selected row” code in CellBackgroundPaint to have the whole row appear visibly selected in a multi-column Listbox on Windows.
Ok i solved. Thanks. I unselected the option:Expandable row.
That is ONLY for hierarchical list boxes on Windows IIRC, hence why asked if was a hierarchical listbox and on Windows.