Board index » cppbuilder » SetFocus() doesn't work in MDI-App

SetFocus() doesn't work in MDI-App

I have a MDI-Form with a toolbar with ComboBoxes on it for changing the
Font and its Size. In a Child-Form I have a RichEdit with the text I
want to change the attributes. In the ComboBoxes-Handler (OnChange) I
call

InputForm->RichEdit->SetFocus();

but it doesn't work. Does anybody know why not? Does it depend, whether
the MDI-Childs are created run-time or not?

Thanks
Claudio

 

Re:SetFocus() doesn't work in MDI-App


Hi Claudio,

Quote
> I have a MDI-Form with a toolbar with ComboBoxes on it for changing the
> Font and its Size. In a Child-Form I have a RichEdit with the text I
> want to change the attributes. In the ComboBoxes-Handler (OnChange) I
> call

Use the API SetFocus() function instead of the TControl::SetFocus() method...

void __fastcall TMainForm::ComboBox1Change(TObject *Sender)
{
    if (ActiveMDIChild)
    {
        ::SetFocus(((TMDIChild *)ActiveMDIChild)->RichEdit1->Handle);
    }

Quote
}

Good luck.

--------------------------------------
Damon Chandler

http://bcbcaq.freeservers.com
Answers to <Commonly Asked Questions>
52064929

Other Threads