tvplanit: Some improvements in VpEdFmtLst.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8508 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-03 17:06:43 +00:00
parent 6bf5ba0284
commit b2991baa90
6 changed files with 29 additions and 31 deletions

View File

@ -384,12 +384,20 @@ procedure TfrmPrnFormat.DoEditFormat;
var
AFormat: TVpPrintFormatItem;
frmEditFormat: TfrmEditFormat;
oldFormatName: String;
begin
if lbFormats.ItemIndex > -1 then begin
Application.CreateForm(TfrmEditFormat, frmEditFormat);
AFormat := TVpPrintFormatItem(lbFormats.Items.Objects[lbFormats.ItemIndex]);
oldFormatName := AFormat.FormatName;
if frmEditFormat.Execute(AFormat) then begin
IsDirty := True;
if AFormat.FormatName <> oldFormatName then
begin
lbFormats.Items.Delete(lbFormats.ItemIndex);
lbFormats.Items.AddObject(AFormat.FormatName, AFormat);
lbFormats.ItemIndex := lbFormats.Items.IndexOf(Aformat.FormatName);
end;
end;
frmEditFormat.Free;
@ -542,27 +550,15 @@ end;
procedure TfrmPrnFormat.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
var
Rslt: Integer;
begin
CanClose := True;
if IsDirty then begin
Rslt := DirtyPrompt;
case Rslt of
ID_YES:
begin
DoSave;
CanClose := True;
end;
ID_NO:
CanClose := True;
ID_CANCEL:
begin
CanClose := False;
Exit;
end;
case DirtyPrompt of
mrYes: DoSave;
mrNo: ;
mrCancel: CanClose := false;
end;
end else
CanClose := True;
end;
end;
function TfrmPrnFormat.GetControlLink: TVpControlLink;