Turn "Drop" confirmation dialogs into custom critical types, so we can set focus to the Cancel button. See http://www.heidisql.com/forum.php?t=14042

This commit is contained in:
Ansgar Becker
2013-11-20 20:52:35 +00:00
parent ef761a897f
commit e832f984f2
2 changed files with 5 additions and 2 deletions

View File

@@ -327,6 +327,7 @@ var
AppSettings: TAppSettings;
MutexHandle: THandle = 0;
SystemImageList: TImageList;
mtCriticalConfirmation: TMsgDlgType = mtCustom;
implementation
@@ -2324,6 +2325,8 @@ var
end;
Btn.Caption := cap;
Btn.ModalResult := BtnResult;
if (DlgType = mtCriticalConfirmation) and (BtnResult = mrCancel) then
Btn.Default := True;
end;
begin
if (Win32MajorVersion >= 6) and StyleServices.Enabled then begin

View File

@@ -2955,7 +2955,7 @@ begin
// drop table selected in tree view.
case ActiveDBObj.NodeType of
lntDb: begin
if MessageDialog(f_('Drop Database "%s"?', [Conn.Database]), f_('WARNING: You will lose all objects in database %s!', [Conn.Database]), mtConfirmation, [mbok,mbcancel]) <> mrok then
if MessageDialog(f_('Drop Database "%s"?', [Conn.Database]), f_('WARNING: You will lose all objects in database %s!', [Conn.Database]), mtCriticalConfirmation, [mbok,mbcancel]) <> mrok then
Abort;
try
db := Conn.Database;
@@ -2997,7 +2997,7 @@ begin
for DBObject in ObjectList do
msg := msg + DBObject.Name + ', ';
Delete(msg, Length(msg)-1, 2);
if MessageDialog(f_('Drop %d object(s) in database "%s"?', [ObjectList.Count, Conn.Database]), msg, mtConfirmation, [mbok,mbcancel]) = mrOk then begin
if MessageDialog(f_('Drop %d object(s) in database "%s"?', [ObjectList.Count, Conn.Database]), msg, mtCriticalConfirmation, [mbok,mbcancel]) = mrOk then begin
try
// Disable foreign key checks to avoid SQL errors
if Conn.ServerVersionInt >= 40014 then