Control's OnExit eats up mouseup event for new control when showing another window

前端 未结 3 1161
小鲜肉
小鲜肉 2020-12-12 04:08

I found this question on Experts-Exchange.

Control\'s OnExit eats up mouseup event for new control when showing another window

The probl

3条回答
  •  执念已碎
    2020-12-12 05:04

    In the onexit event I show a warningbox and then want to proceed as normal - moving the focus to where the user in fact clicked. Is that possible?

    Yes, (Screen.)ActiveControl will always point to Edit3: before and after the call to ShowMessage:

    procedure TForm1.Edit1Exit(Sender: TObject);
    begin
      ShowMessage('Exit');
      PostMessage(ActiveControl.Handle, WM_LBUTTONUP, 0, 0);
    end;
    

    But this is just for completeness sake to your question! And it certainly is no tip nor advice! See Sertac's answer for the reason.

提交回复
热议问题