LazReport, fix preview blocking bug, issue #13399

git-svn-id: trunk@19116 -
This commit is contained in:
jesus 2009-03-26 14:48:47 +00:00
parent 42541fc98c
commit a6893bb23f
6 changed files with 59 additions and 40 deletions

View File

@ -27,7 +27,7 @@ Lazarus Port: Olivier Guilbaud, Jesus Reyes A.
See license.txt and license-lazreport.txt for details. See license.txt and license-lazreport.txt for details.
"/> "/>
<Version Minor="9" Release="5"/> <Version Minor="9" Release="5"/>
<Files Count="48"> <Files Count="51">
<Item1> <Item1>
<Filename Value="lr_class.pas"/> <Filename Value="lr_class.pas"/>
<UnitName Value="LR_Class"/> <UnitName Value="LR_Class"/>
@ -221,6 +221,18 @@ See license.txt and license-lazreport.txt for details.
<Filename Value="lr_propedit.pas"/> <Filename Value="lr_propedit.pas"/>
<UnitName Value="lr_propedit"/> <UnitName Value="lr_propedit"/>
</Item48> </Item48>
<Item49>
<Filename Value="lr_progr.lfm"/>
<Type Value="LFM"/>
</Item49>
<Item50>
<Filename Value="lr_progr.lrs"/>
<Type Value="LRS"/>
</Item50>
<Item51>
<Filename Value="lr_progr.pas"/>
<UnitName Value="LR_progr"/>
</Item51>
</Files> </Files>
<i18n> <i18n>
<EnableI18N Value="True"/> <EnableI18N Value="True"/>
@ -250,7 +262,6 @@ See license.txt and license-lazreport.txt for details.
</UsageOptions> </UsageOptions>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedpackage\"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
</PublishOptions> </PublishOptions>
</Package> </Package>

View File

@ -7,10 +7,10 @@ unit lazreport;
interface interface
uses uses
LR_Class, LR_Desgn, LR_Register, LR_Flds, LR_DBSet, LR_BarC, LR_BndEd, LR_Class, LR_Desgn, LR_Register, LR_Flds, LR_DBSet, LR_BarC, LR_BndEd,
LR_PGrid, LR_View, lr_expres, lr_funct_editor_unit, lr_funct_editor_unit1, LR_PGrid, LR_View, lr_expres, lr_funct_editor_unit, lr_funct_editor_unit1,
LR_Prntr, LR_Edit, LR_Pars, LR_fmted, LR_Const, LR_pgopt, LR_Dopt, LR_GEdit, LR_Prntr, LR_Edit, LR_Pars, LR_fmted, LR_Const, LR_pgopt, LR_Dopt, LR_GEdit,
LR_Utils, LR_GrpEd, lr_propedit, LazarusPackageIntf; LR_Utils, LR_GrpEd, lr_propedit, LR_progr, LazarusPackageIntf;
implementation implementation

View File

@ -21,7 +21,7 @@ uses
LCLType,LCLIntf,TypInfo,LCLProc, LCLType,LCLIntf,TypInfo,LCLProc,
SysUtilsAdds, SysUtilsAdds,
LR_View, LR_Pars, LR_Intrp, LR_DSet, LR_DBSet, LR_DBRel,LR_Const; LR_View, LR_Pars, LR_Intrp, LR_DSet, LR_DBSet, LR_DBRel, LR_Const;
const const
// object flags // object flags
@ -7959,35 +7959,28 @@ var
procedure TfrReport.BuildBeforeModal(Sender: TObject); procedure TfrReport.BuildBeforeModal(Sender: TObject);
begin begin
{$IFDEF DebugLR} {$IFDEF DebugLR}
DebugLn('20'); DebugLn('TfrReport.BuildBeforeModal INIT FinalPass=',dbgs(FinalPass),' DoublePass=',dbgs(DoublePass));
{$ENDIF} {$ENDIF}
DoBuildReport; DoBuildReport;
{$IFDEF DebugLR}
DebugLn('21');
{$ENDIF}
if FinalPass then if FinalPass then
begin begin
if Terminated then if Terminated then
frProgressForm.ModalResult := mrCancel frProgressForm.ModalDone(mrCancel)
else else
frProgressForm.ModalResult := mrOk; frProgressForm.ModalDone(mrOk);
end end
else else
begin begin
{$IFDEF DebugLR}
DebugLn('22');
{$ENDIF}
FirstPassTerminated := Terminated; FirstPassTerminated := Terminated;
SavedAllPages := EMFPages.Count; SavedAllPages := EMFPages.Count;
DoublePass := False; DoublePass := False;
FirstTime := False; FirstTime := False;
DoPrepareReport; // do final pass DoPrepareReport; // do final pass
DoublePass := True; DoublePass := True;
{$IFDEF DebugLR}
DebugLn('23');
{$ENDIF}
end; end;
{$IFDEF DebugLR}
DebugLn('TfrReport.BuildBeforeModal DONE');
{$ENDIF}
end; end;
function TfrReport.PrepareReport: Boolean; function TfrReport.PrepareReport: Boolean;

View File

@ -3,8 +3,7 @@ object frProgressForm: TfrProgressForm
Height = 106 Height = 106
Top = 137 Top = 137
Width = 278 Width = 278
HorzScrollBar.Page = 277 ActiveControl = Button1
VertScrollBar.Page = 105
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'frProgressForm' Caption = 'frProgressForm'
ClientHeight = 106 ClientHeight = 106
@ -13,11 +12,12 @@ object frProgressForm: TfrProgressForm
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '0.9.27'
object Label1: TLabel object Label1: TLabel
Left = 20 Left = 20
Height = 14 Height = 16
Top = 32 Top = 32
Width = 7 Width = 9
Alignment = taCenter Alignment = taCenter
Caption = '1' Caption = '1'
ParentColor = False ParentColor = False
@ -34,4 +34,11 @@ object frProgressForm: TfrProgressForm
OnClick = Button1Click OnClick = Button1Click
TabOrder = 0 TabOrder = 0
end end
object Timer1: TTimer
Enabled = False
Interval = 10
OnTimer = Timer1Timer
left = 224
top = 24
end
end end

View File

@ -2,13 +2,15 @@
LazarusResources.Add('TfrProgressForm','FORMDATA',[ LazarusResources.Add('TfrProgressForm','FORMDATA',[
'TPF0'#15'TfrProgressForm'#14'frProgressForm'#4'Left'#3#235#0#6'Height'#2'j'#3 'TPF0'#15'TfrProgressForm'#14'frProgressForm'#4'Left'#3#235#0#6'Height'#2'j'#3
+'Top'#3#137#0#5'Width'#3#22#1#18'HorzScrollBar.Page'#3#21#1#18'VertScrollBar' +'Top'#3#137#0#5'Width'#3#22#1#13'ActiveControl'#7#7'Button1'#11'BorderStyle'
+'.Page'#2'i'#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#14'frProgressForm'#12 +#7#8'bsDialog'#7'Caption'#6#14'frProgressForm'#12'ClientHeight'#2'j'#11'Clie'
+'ClientHeight'#2'j'#11'ClientWidth'#3#22#1#11'Font.Height'#2#245#9'Font.Name' +'ntWidth'#3#22#1#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'On'
+#6#13'MS Sans Serif'#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenC' +'Create'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6
+'enter'#0#6'TLabel'#6'Label1'#4'Left'#2#20#6'Height'#2#14#3'Top'#2' '#5'Widt' +'0.9.27'#0#6'TLabel'#6'Label1'#4'Left'#2#20#6'Height'#2#16#3'Top'#2' '#5'Wid'
+'h'#2#7#9'Alignment'#7#8'taCenter'#7'Caption'#6#1'1'#11'ParentColor'#8#0#0#7 +'th'#2#9#9'Alignment'#7#8'taCenter'#7'Caption'#6#1'1'#11'ParentColor'#8#0#0#7
+'TButton'#7'Button1'#4'Left'#2'd'#6'Height'#2#25#3'Top'#2'D'#5'Width'#2'K'#25 +'TButton'#7'Button1'#4'Left'#2'd'#6'Height'#2#25#3'Top'#2'D'#5'Width'#2'K'#25
+'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalR' +'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalR'
+'esult'#2#2#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#0 +'esult'#2#2#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#6'TTimer'#6'Ti'
+'mer1'#7'Enabled'#8#8'Interval'#2#10#7'OnTimer'#7#11'Timer1Timer'#4'left'#3
+#224#0#3'top'#2#24#0#0#0
]); ]);

View File

@ -21,7 +21,7 @@ uses
LCLProc, LCLProc,
LR_Class, LR_Const; LR_Const, LR_Class, ExtCtrls;
const const
CM_BeforeModal = WM_USER + 1; CM_BeforeModal = WM_USER + 1;
@ -33,20 +33,22 @@ type
TfrProgressForm = class(TForm) TfrProgressForm = class(TForm)
Button1: TButton; Button1: TButton;
Label1: TLabel; Label1: TLabel;
Timer1: TTimer;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private private
{ Private declarations } { Private declarations }
fDoc: TfrReport; fDoc: TfrReport;
fOnBeforeModal: TNotifyEvent; fOnBeforeModal: TNotifyEvent;
procedure DoBeforeModal(Data: ptrint); procedure DoBeforeModal(Data: ptrint);
public public
{ Public declarations } { Public declarations }
FirstCaption: String; FirstCaption: String;
property OnBeforeModal: TNotifyEvent read FOnBeforeModal write FOnBeforeModal;
function Show_Modal(Doc: TfrReport): Word; function Show_Modal(Doc: TfrReport): Word;
procedure ModalDone(AModalResult: TModalResult);
property OnBeforeModal: TNotifyEvent read FOnBeforeModal write FOnBeforeModal;
end; end;
var var
@ -63,15 +65,14 @@ begin
Visible:=False; Visible:=False;
Enabled:=True; Enabled:=True;
ModalResult:=mrNone; ModalResult:=mrNone;
{$IFDEF DebugLR}
DebugLn('A1');
{$ENDIF}
InitializeWnd; InitializeWnd;
Result:=ShowModal; Result:=ShowModal;
{$IFDEF DebugLR} end;
DebugLn('A2');
{$ENDIF} procedure TfrProgressForm.ModalDone(AModalResult: TModalResult);
begin
ModalResult := AModalResult;
Timer1.Enabled:=true;
end; end;
procedure TfrProgressForm.Button1Click(Sender: TObject); procedure TfrProgressForm.Button1Click(Sender: TObject);
@ -91,6 +92,11 @@ begin
Button1.Caption:=sCancel; Button1.Caption:=sCancel;
end; end;
procedure TfrProgressForm.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled:=false;
end;
initialization initialization
{$I lr_progr.lrs} {$I lr_progr.lrs}