oldteacher
Active member
Had to update an older app compiled with 1.7. Had setup to alert user when they closed app and had used this in 1.7 scripting:
This is what I used in 2.1. Issue having is clicking “No” button also closes the app:
Please help me get the above working in 2.1.
Thanks
Code:
function OnWindowCloseQuery (WindowName: String): Boolean;
begin
// Ask user if they really wish to close window
Result := True;
if MessageBox("Exit Software?"#13#10#13#10"Did You Save Your Work? Click Yes if So!"#13#10#13#10"Choose No to Cancel & Then Save...",
"Exit Confirmation", MB_YESNO+MB_ICONWARNING) = IDNO then Result := False;
end;
Code:
procedure OnCloseWindow(WindowName: String);
begin
// When a window is closed by the user.
// Ask user if they really wish to close window
Result := True;
if MessageBox("Exit Software?"#13#10#13#10"Did You Save Your Work? Click Yes if So!"#13#10#13#10"Choose No to Cancel & Then Save...",
"Exit Confirmation", MB_YESNO+MB_ICONWARNING) = IDNO then Result := False;
end;
Thanks