How to implement Ctrl+MouseDown in Listbox

Can we simulate Ctrl+MouseDown key pair of Windows to select one row and the other row selectively in ListBox?
Shift+MouseDown key works as expected like I do in Windows, but Ctrl+MouseDown doesn’t show any result, so please advise me to implement that feature.

First of all, read listbox .

Second, get an eye on the KeyDown event.

Third, something like:

If Keyboard.ControlKey (info Here ).

Come back here if the explanation above is not enought.

After a re-reading of the question:
You may have to store somewhere the Row clicks and use .Selected to select all rows like you want.

That said, I do not understand why you want to do that (but I may need a nap).

look at the constructcontextualmenu event of the listbox. there are example in the dev manual.

Jean-Yves, Changwon is on PC. There, Ctrl-MouseDown is not the same as right click.

Changwon : Use KeyBoard.ControlKey to check is Control is down.

[quote=284591:@changwon lee]Can we simulate Ctrl+MouseDown key pair of Windows to select one row and the other row selectively in ListBox?
Shift+MouseDown key works as expected like I do in Windows, but Ctrl+MouseDown doesn’t show any result, so please advise me to implement that feature.[/quote]
It does this by default if you set MultiSelect to true

Should I use a Timer(Action Event) to check CTRL key is down with KeyBoard.ControlKey?
link text

If that is the case, how can I enable the Timer? I know how to enable/disable it but it doesn’t make sense to me as it seems that I should enable it with a very short of interval?

No You simply check Keyboard.Control key in MouseDown.

Norm is correct:

You dont need to trap it using mousedown.
Just set the multiselect property to TRUE in the IDE

It is already set with MultiSelect(True).

My plan is:
There are 100 rows.
I drag 20 rows from 1 to 20 and 20 rows are selected.
Then, I should jump 51th rows and select it, so finally I select 21 rows.

For this requirement, I thought I should implement CTRL+Mouse Click to select the one.

[quote=284782:@changwon lee]It is already set with MultiSelect(True).

My plan is:
There are 100 rows.
I drag 20 rows from 1 to 20 and 20 rows are selected.
Then, I should jump 51th rows and select it, so finally I select 21 rows.

For this requirement, I thought I should implement CTRL+Mouse Click to select the one.[/quote]

That should be automatic under Windows.

There is nothing to implement. If you have tried it and it doesn’t work, then there may be some bug in your code that is interfering with the normal behavior.

Yes, I think Jeremie UI_Listbox interferes the native feature. I don’t see any issue with a Xojo listbox.

Thanks.

I wrote a listbox subclass to fix issues with multiselect in the standard Xojo listbox on windows.

https://www.dropbox.com/s/gqx67mrf9orld1l/WinListBox.xojo_binary_project?raw=1

http://forum.xojo.com/conversation/post/332957

[quote=340730:@Neil Burkholder]I wrote a listbox subclass to fix issues with multiselect in the standard Xojo listbox on windows.

https://www.dropbox.com/s/gqx67mrf9orld1l/WinListBox.xojo_binary_project?raw=1

http://forum.xojo.com/conversation/post/332957[/quote]
You don’t need that anymore. The issue was fixed in 2017r1.

Issues you mean?

My subclass provides a workaround for the following feedback cases. As of today none of these have been implemented.

43704 - Status: Verified
43705 - Status: Verified
46694 - Status: Needs Review
46521 - Status: Verified
46520 - Status: Verified