Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Win 32 Controls/TComboBoxEx    [ Add a report in this area ]  
Report #:  33459   Status: Closed
TComboBoxEx keeps Focused
Project:  Delphi Build #:  2565
Version:    10.0 Submitted By:   christophe ruaud
Report Type:  Minor failure / Design problem Date Reported:  9/4/2006 8:31:36 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   257405
Resolution: Cannot Reproduce (Resolution Comments) Resolved in Build: : 12.0.3116.15001
Duplicate of:  None
Voting and Rating
Overall Rating: (2 Total Ratings)
2.50 out of 5
Total Votes: None
Description
When TComboBoxEx control is focused, the function Form->ActiveControl doesn't work.
The TComboBoxEx keeps focused.
Steps to Reproduce:
Create Form with TComboBoxEx and TEdit.

TComboBoxEx::OnKeyPressed  :
if(Key==VK_RETURN)
  Form->ActiveControl=Tedit;
This code doesn't work

TEdit::OnKeyPressed    
if(Key==VK_RETURN)
  Form->ActiveControl=TComboBoxEx;
This code works fine

Workarounds
None
Attachment
None
Comments

Patrick Kolla-ten Venne at 9/10/2006 9:31:38 AM -
The real build number is available from the help about menu.

As a workaround, I could suggest to use SetFocus(myeditinstanvce.handle); ... or if you're C (isn't this the Delphi category?), SetFocus(myeditinstanvce->handle) I guess.

Anyway, in your example, i see:

  Form->ActiveControl=Tedit;
  Form->ActiveControl=TComboBoxEx;

I'm wondering why the second code would work, since you're trying to assign a class type to a class var, which should fail under any circumstances ;)

Sebastian Modersohn at 9/10/2006 3:35:08 PM -
Have you checked if TComboBoxEx::OnKeyPressed actually gets called with vk_Return? Since a combobox can have an internal edit control I'd guess that this is "eating" the return key. Have a look at the Form's KeyPreview property. That would also give you the ability to have all that activation code in a single event handler (TForm::OnKeyPress).

If this doesn't help then by all means post more detailed steps or even better: a test-case!

Server Response from: ETNACODE01