Lisbox select row

If a listbox has selection mode single, calling LISTBOX SELECT ROW with lk add to selection selects multiple rows.

I can’t see anything in the documentation, but somehow I’d have expected only to be able to select a single row (in other words, when selection mode is single, lk add to selection to have the same effect as lk replace selection).

Am I wrong? Is it a bug?

Jeremy

This is what it is says in the documentation for LISTBOX SELECT ROW:

“The optional action parameter, if passed, is used to define the selection action to execute when a selection of rows already exists in the list box.”

For lk add to selection: “The row selected is added to the existing selection.”

Hope that helps.

Regards,
Nhat

Nhat,

I understand that, thanks. All I was pointing out was the fact that LSR with lk add to selection can create a multiple selection in a listbox which has selection mode Single seems to me to be inconsistent. I’d have thought the listbox’s own selection mode would take priority.

Jeremy

Sounds like the command is stronger than the property.

The property would relate to user interaction only, programmatically you aren’t limited by what the user can/can’t do.

Consider a listbox with selection mode = none. Even though you don’t want the user to select rows, you might still want to be able to show a row as selected - which you can do using the command.

I’m not trying to say it’s normal. But, as I’m not a fan of the properties palette (I wonder how many time I’ve spent trying to find something obvious because of different position depending on what is selected), I tend to use code instead. Code stronger than property fits this “programming style”.

Hi,

Indeed, the LISTBOX SELECT ROWS command add some new rows to the selected rows or replaces the current selected rows by new ones.
There is no check regarding if the selection mode is Single or Multiple.

When you can do this by code YES, but sometime there is no code equivalent :unamused:

Thanks for confirming that that is indeed how it is supposed to be, Marie-Sophie.

I suppose whether code should be allowed to supersede design is a philosophical question.

Jeremy