Solved

TCheckListBox -

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

14 Experts available now in Live!

Get 1:1 Help Now