MessageDlg is non centered and has not focus if Button.Enabled is False
Original Reporter info from Mantis: Stefano
-
Reporter name: Stefano
Original Reporter info from Mantis: Stefano
- Reporter name: Stefano
Description:
Hello, with Lazarus 1.0 on GTK/2 and Linux (Debian), if in a TButton_OnClick event I execute code and disable then button while the procedure works, the next MessageDlg is not centered and has no focus.
The prolem occours if you set the button Enabled = False while the procedure works, in order to avoid that the user press again the button while before the procedure is in execution (of course, it is also possibile to use a flag, but I prefere that in order that the user can understand that the button is disabled
and the procedure is still working; moreover this is also easier if you
have a panel or other controls the contains more buttons).
I attach a simple project that shows the problem, below I write the code that you can use to reproduce the problem.
With Lazarus 0.9.28.2 all worked fine.
Best regards,
Stefano
Additional information:
procedure TForm3.btnMessageDlgClick(Sender: TObject);
var
MyCursor: TCursor;
begin
if (MessageDlg ('Show MessageDlg?', mtWarning, [mbOk, mbCancel], 0) <> mrOk) then exit;
btnMessageDlg.Enabled := False; //if you comment --> no errors
MyCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
Application.ProcessMessages;
{Executing code for calculs, .....}
Application.ProcessMessages;
btnMessageDlg.Enabled := True; //if you comment --> no errors
Screen.Cursor := MyCursor;
Application.ProcessMessages;
//THIS MESSAGEDLG IS NOT CENTERED AND HAS NO FOCUS:
MessageDlg ('This MessageDlg is not centerd and has no window focus!', mtInformation, [mbOk], 0); //Here is the problem
end;
Mantis conversion info:
- Mantis ID: 23019
- Version: 1.0.0
- Monitored by: » Stefano (Stefano)