Forum > LazReport

can't close windows after saving to pdf from a preview

(1/1)

tintinux:
Hi

With all recent stable releases (1.8.4, 2.0.0), but only on Linux, when I preview a report and then use the button to save it, the save dialog is displayed, the report is correctly saved, but after that the preview Windows goes behind the others and I can't close it and it's parent. I must kill the application.

Setting the preview as modal or not has no effect.

I have searched in the source (LR_Preview.pas) and found that it looks like it is caused by the save dialog.

If I remove the call to the save dialog and replace the filename by a constant like this :


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    {    SaveDialog.FilterIndex := Index;    if SaveDialog.Execute then    begin      Index := SaveDialog.FilterIndex - 1;      if fExtList.Objects[Index]=nil then        SaveToFile(SaveDialog.Filename) // using .frp      else      begin        Index := PtrInt(fExtList.Objects[Index])-1;        ExportToWithFilterIndex(Index, SaveDialog.FileName);    }        ExportToWithFilterIndex(0, '/tmp/test.pdf');    {      end;    end;    }  

I have no more problem, the preview remains on foreground and can be closed, as the other windows.

Has anyone found this issue or any idea to solve this ?

Thanks





balazsszekely:
What happens if you set the preview window's formstyle to fsStayOnTop(alternatively fsSystemStayOnTop) just before you show the save dialog? You can chage it back to fsNormal after the report is saved.
 

tintinux:
Hi

This ? 


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TfrPreviewForm.SaveBtnClick(Sender: TObject);var  i, Index: Integer;  FilterStr: string;  FilterInfo: TExportFilterItem;  FExtList:TStringList;  OldStyle:TFormStyle;begin  if EMFPages = nil then Exit;  FExtList:=TStringList.Create;  try    Index := 1;    if not (roHideDefaultFilter in TfrReport(Doc).Options) then    begin      FExtList.Add('*.frp');      FilterStr := sRepFile + ' (*.frp)|*.frp';    end else      FilterStr := '';     for i := 0 to ExportFilters.Count - 1 do    begin      FilterInfo := ExportFilters[i];      if FilterInfo.Enabled then      begin        FExtList.AddObject(FilterInfo.FilterExt, TObject(PtrInt(i+1)));        if FilterStr <> '' then          FilterStr := FilterStr + '|';        FilterStr := FilterStr + FilterInfo.FilterDesc + '|' + FilterInfo.FilterExt;      end;    end;    OldStyle := FormStyle;    FormStyle := fsStayOnTop;    try      SaveDialog.Filter := FilterStr;      SaveDialog.FilterIndex := Index;      if SaveDialog.Execute then      begin        Index := SaveDialog.FilterIndex - 1;        if fExtList.Objects[Index]=nil then          SaveToFile(SaveDialog.Filename) // using .frp        else        begin          Index := PtrInt(fExtList.Objects[Index])-1;          ExportToWithFilterIndex(Index, SaveDialog.FileName);        end;      end;    finally       FormStyle := OldStyle;    end;  finally    FExtList.Free;    ScrollBox1.Invalidate;  end;end;         

It doesn't change anything...
With fsSystemStayOnTop it is worse : the SaveDialog doesn't show and the application hangs.

Regards
Tintinux

Navigation

[0] Message Index

Go to full version