Solved

TCheckListBox -

Posted on 1998-11-01
5
234 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now