Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Listbox Multi-Select Without Ctrl Key

Posted on 2004-10-20
3
Medium Priority
?
1,732 Views
Last Modified: 2008-01-09
When a Listbox is set to multi-select, I know you can select/deselect individual items by single-clicking on them with the Ctrl key held down.

Is it possible to do it without using the Ctrl key - for example when using a touch sensitive screen when a keyboard isn't available?

I have a button on the form which acts as a toggle. Using this button's Tag property I can effectively turn a 'virtual' Ctrl key on and off, but I'm not sure how to go about acting on this toggle to select/deselect items on the list.

(For those of you not familiar with touch screens, a finger press on the screen simply generates a single mouse click at that screen X/Y position).

I've tried using the OnMouseDown event using an If...Then to check if the button Tag property is 0 or 1, but a single click still deselects all the other items.

Any suggestions please?

TDK_Man
0
Comment
Question by:tdk_man
3 Comments
 
LVL 1

Accepted Solution

by:
vacerose earned 500 total points
ID: 12358629
Try setting the listbox "ExtendedSelect" property to false.

Following was taken from delphi help

If ExtendedSelect is false and MultiSelect is true, the user can select multiple items without using the Shift or Ctrl key, but they can’t select a range of items in one operation.

For more details, lookup help on TListBox and see the ExtendedSelect property.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12358648
I'm not sure. Is the Listbox.Selected[] property readonly? I don't think it is so you could just set it yourself. Maybe change the OnClick behaviour too then. But as an alternative, Delphi 7 offers a CheckListbox where you can check and uncheck items instead of selecting them. Might be easier?
0
 
LVL 1

Author Comment

by:tdk_man
ID: 12358770
Well I'll be!...

You are correct vacerose - it was that simple!

You apparently learn something new every day, so I can go back to being braindead for the rest of this one!  :)

Thanks far that...

Alex:

I'm using V5 and the Listbox.Selected[] property isn't readonly - I was just finding it impossible to over-ride the component's natural tendency to deselect all items on single clicking.

I even tried creating a boolean array and storing all of the listbox items Selected properties then setting them all at the end of the routine - which didn't work either.

Not to worry now though, simply setting ExtendedSelect  to False did the trick!

TDK_Man
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question