fix, error message when editor widget not visible and if a doc is opened

This commit is contained in:
Basile Burg 2016-11-30 10:15:32 +01:00
parent 748a887ea9
commit 102407898a
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 8 additions and 3 deletions

View File

@ -491,8 +491,10 @@ procedure TCEEditorWidget.openDocument(fname: string);
var var
doc: TCESynMemo; doc: TCESynMemo;
begin begin
showWidget;
doc := findDocument(fname); doc := findDocument(fname);
if doc.isNotNil then begin if doc.isNotNil then
begin
PageControl.currentPage := TCEPage(doc.Parent); PageControl.currentPage := TCEPage(doc.Parent);
exit; exit;
end; end;
@ -512,9 +514,12 @@ var
doc: TCESynMemo; doc: TCESynMemo;
begin begin
doc := getDocument(index); doc := getDocument(index);
if doc.isNil then exit(false); if doc.isNil then
exit(false);
if (doc.modified or (doc.fileName = doc.tempFilename)) and if (doc.modified or (doc.fileName = doc.tempFilename)) and
(dlgFileChangeClose(doc.fileName, UnsavedFile) = mrCancel) then exit(false); (dlgFileChangeClose(doc.fileName, UnsavedFile) = mrCancel) then
exit(false);
showWidget;
doc.disableFileDateCheck:=true; doc.disableFileDateCheck:=true;
pageControl.pageIndex:=index; pageControl.pageIndex:=index;
doc.Free; doc.Free;