?
Solved

ComboBox - problem with Focused method

Posted on 2003-03-24
6
Medium Priority
?
496 Views
Last Modified: 2010-04-04
When I use a ComboBox in my program, the Focused method does not seem to pick up that the component has focus. I used an Edit component before, which worked perfectly (picking up the focus status through the Focused method), but then had to change to a ComoboBox. Now the Focused method always returns False.

Any ideas?
0
Comment
Question by:wyngaard
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 60 total points
ID: 8194701
what about to lookup the activcontrol-property of your form?
0
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 8195267
I think that the focused property of the Combobox work fine, try this example:

procedure TForm1.Button1Click(Sender: TObject);
begin
Combobox1.SetFocus;
if Combobox1.Focused then
ShowMessage('I have focus.');
end;

Best Regards
Marcos.

"Congratulations Meik for your first position"
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8195305
>Congratulations Meik for your first position
thanks, marcos,
go here to teh official gratulations thread ;-)

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20543892.html
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:wyngaard
ID: 8195464
Thanks for the lateral thinking - checking the ActiveControl property of the form works without a problem.

I would still like to know why the Focused method does not work and if anyone has come up with a fix for this.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8195502
as marcos confirmed it should work also with a combobox,
there must be a information, which is missed here.

do you adjust any properties?
or are there any events triggered,
before the focus is gained on the combobox?

btw.
thanks for the points :-))
glad that this helps you

meikl ;-)
0
 

Author Comment

by:wyngaard
ID: 8195804
I tried marcos's test, and it fails (no message pops up).

I think the missing information might be that I am working in Delphi 3 - this bug might have been fixed in later versions of Delphi.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

616 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