Mega Code Archive

 
Categories / Delphi / VCL
 

Handle lost focus problem in a TEdit

Title: handle lost focus problem in a TEdit? To Reproduce the Problem: Um das Problem nachzuvollziehen: 1. Drop two TEdits onto a form. Plaziere zwei TEdits auf einer Form. 2. In the OnExit Event of Edit1 add the following code: Im OnExit Ereignis von Edit1 schreibe diesen Code: Application.MessageBox( 'Title','...', mb_ok ); 3. Run the application. Starte die Anwendung. 4. First select Edit1 then Edit2 Klicke auf Edit und dann auf Edit2 5. The Message box is shown. Click the OK button, and the Caret has dissapeared! Eine MessageBox wird angezeigt. Klicke auf den OK Button und der Cursor ist verschwunden! 6. How to handle this: Wie man das umgehen kann: procedure TForm1.Edit1Exit(Sender: TObject); begin Application.MessageBox('qq','qq',mb_ok); if Assigned(ActiveControl) then PostMessage(ActiveControl.Handle,WM_SETFOCUS,0,0); end;