Setting focus back to original Delphi form problem

Posted by BillS on July 23, 2008

"Using Turbo Delphi:

If I click on a Delphi messagebox "ok" button, code can't enable a tedit textbox for user input. The cursor is in the desired tedit box, but user has to mouse-click on form or into text box before able to enter data.

Seems that the Delphi form and form controls are not enabled after quiting a messagedlg() (or a showmessage() for that matter).

Here's a snippet of code that doesn't behave as I think it should:

MessageDlg( 'Here is the message', mtinformation,[mbok], 0); teethstr.SetFocus;
// sets cursor into box but doesn't allow user to enter keyboard data Exit;

Workaround is to mouse-click the form, or click the box. I want the user to click "ok" to close the messagebox, then start typing at cursor in the tedit box.

Please help-been trying to solve this one for a few days now...

Related articles


Follow Ups