?
Solved

CheckBox Question

Posted on 2000-02-03
8
Medium Priority
?
242 Views
Last Modified: 2010-04-04
Does anyone know of a way of 'hiding' the focus of a CheckBox's Caption when it's state is changed?

i.e. I want to be able to change the state of the CheckBox, without that causing it's caption to be focused or 'highlighted'.

Cheers, Chris.
0
Comment
Question by:she3i3i
8 Comments
 
LVL 2

Expert Comment

by:florisb
ID: 2485747
Hello,

focuscontrol(othercomponent);

after changing the state should help.

Floris.
0
 

Accepted Solution

by:
gnom earned 90 total points
ID: 2485775
this is a very simple answer. but it will solve your problem i think.

take a checkbox and clear the caption of the checkbox (resize the checkbox that its width and height is about 17 pixels). then put a label to the right side of the checkbox and put your checkbox text to the caption of the label.

now you'll never see a focus rect. if you the checkbox changing when someone clicks on the caption. then change checkbox state in the onclick of the label.

regs
  gnom
0
 
LVL 1

Author Comment

by:she3i3i
ID: 2485789
florisb:

I do not have an OnClick event for the checkbox. I'm reading its state from somewhere else and do not particularly want to put in an OnClick event just for that. I've used this method before and at the end of a project, code just gets too messy to read.

gnom:

I have also used this method, and although its alot cleaner, I'm still curious if there is another way to go about it.


Cheers, Chris.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
LVL 2

Expert Comment

by:florisb
ID: 2485830
simple and effective?

try in form's onshow:

//focus on checkbox's caption
checkbox1.checked := false;

of

//focus somewhere else
checkbox1.checked := false;
focuscontrol(button1);


Isn;t this what you want?

Floris.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2486051
You don't need an onclick event for the checkbox if you use a label as suggested by gnom.  Just create an OnClick event for the label that says...

  CheckBox1.Checked:=Not CheckBox1.Checked;

That'll do the trick!

John.
0
 
LVL 3

Expert Comment

by:ckaneta
ID: 2487351
you can make it have a parent that is not enabled, then the CanFocus property
is False
0
 
LVL 2

Expert Comment

by:florisb
ID: 2487505
Or use dummy components for the visual effect; without events, and make the real one's invisible; place them on top of each other.

Never mind, it's late here...

How about it? I don't get why your code get's messy by what you want.
0
 
LVL 1

Author Comment

by:she3i3i
ID: 2492387
Although I have used the method before and... by the looks of it... again, I'm giving the points to gnom out of good old sportmanship as it was the closest to what I wanted to do.

Regards, Chris.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…

598 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