mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user