procedure TMyWin.MenuFileOpen(var Msg: TMessage);
var
   i, nChecks, reply : integer;
   fname : text;
   aCheck: Check;
begin
     reply := id_No;
     if (isDirty) then
        reply := MessageBox(HWindow,'Are you sure', 'File not saved', mb_YesNo + mb_IconQuestion);
     if (reply = id_Yes) or (not isDirty) then
        begin
     StrCopy(FileName,'*.brt');
     reply := Application^.ExecDialog(New(PFileDialog, Init(@self, PChar(sd_FileOpen), FileName)));
     if (reply = id_OK) then
        begin
             DestroyList(CheckBook);
             Assign(fname, FileName);
             Reset(Fname);
             Readln(FName,nChecks);
             for i := 1 to nChecks do begin
                 ReadCheckFromFile(aCheck, FName);
                 Insert(CheckBook, aCheck);
             end;
             Close(Fname);
             RedoListBox;
             isDirty := false;
             isSaved := true;
             isNewFile := false;
        end;
     end;
end;