Solved

TCheckListBox -

Posted on 1998-11-01
5
240 Views
Last Modified: 2010-04-06
I am using a TCheckListBox with style lbOwnerDrawFixed. It displays drives with little pictures depending on the type of drive. It works great except that when the user clicks on the text/picture it draws a rectangle around it (sort of like to show the focus). I don't like it. I would like either one of the two following behaviours:

1 - when they click on the text/picture, behave as if the checkbox itself had been clicked and without the rectangle(my first choice)

2 - at least not get the rectangle.
0
Comment
Question by:sharons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345351
sharons, why then don't you just use TListBox or TCombobox with lbOwnerDrawFixed? ZiF.

0
 

Author Comment

by:sharons
ID: 1345352
I do need the check boxes. I use this for the user to select the drives to be made available at a kiosk. This is part of the setup process.  Sorry if I was not clear.
0
 

Expert Comment

by:atze
ID: 1345353
why don't you use TListBox and a TImageList? Get the images you need and do the changes of the checkbox by your owne that's all.
0
 

Author Comment

by:sharons
ID: 1345354
Sorry, I don't understand your solution. Here is exacly what I do:

When users first use my program, they have to select one or many drives. So I loop from a to z and see which letters are valid drive. So I add an item in the TCheckListBox (with style lbOwnerDrawFixed). For each item I draw a little image and the drive letter. And of course the actual chack box is there beside each item (which is what I need). The user then checks all the desired drives. I then create a string with all the drive letters Ex: ACD and saves that to the registry.

My problem is that if the user clicks on the text or image (instead of the little check box) then one or more item gets a rectangle drawn around it as if it had the focus. This looks bad and this is what I want to get rid of. I do need the check boxes so why would I use a TListBox ? Maybe I am missing your point.

You can test what I mean by dropping a TCheckListBox on a form. Add a few items then click on the text. Whatever happens to the text is what I want to eliminate. It might just draw one rectangle at the time (I just realize that when I said rectangle you might have though I was talking about the checkbox itself, I am talking about a "Focus rectangle").
0
 

Accepted Solution

by:
atze earned 20 total points
ID: 1345355
You don't have to use TTreeView but if you don't like the Focusrectangle around your pictures this is one possible solution

Add a TTreeNode for every Drive and set the ImageIndex to the right Image in the ImageList (a checked and an unchecked checkbox in the ImageList plus your Drive images). You can now change the Image in the TreeView by changing the ImageIndex of the TreeNode.


0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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