GridPrinter: Check whether printers are installed also for Preview.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9186 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-01-30 17:43:46 +00:00
parent 9cb6e4ae53
commit e3cba0674d
2 changed files with 15 additions and 11 deletions

View File

@ -62,7 +62,7 @@ type
implementation implementation
uses uses
Graphics, Controls, LCLIntf, LCLType; Graphics, Controls, LCLIntf, LCLType, Printers;
{ TGridPrintPreviewFormParams } { TGridPrintPreviewFormParams }
@ -126,6 +126,9 @@ begin
if FGridPrinter = nil then if FGridPrinter = nil then
exit; exit;
if Printer.Printers.Count = 0 then
raise EPrinter.Create('No printers defined.');
F := TGridPrintPreviewForm.Create(nil); F := TGridPrintPreviewForm.Create(nil);
try try
F.GridPrinter := FGridPrinter; F.GridPrinter := FGridPrinter;

View File

@ -6,16 +6,17 @@ object GridPrintPreviewForm: TGridPrintPreviewForm
Caption = 'Print Preview' Caption = 'Print Preview'
ClientHeight = 649 ClientHeight = 649
ClientWidth = 901 ClientWidth = 901
OnActivate = FormActivate
Position = poMainFormCenter Position = poMainFormCenter
ShowHint = True ShowHint = True
LCLVersion = '2.3.0.0' LCLVersion = '3.99.0.0'
OnActivate = FormActivate
object ToolBar: TToolBar object ToolBar: TToolBar
Left = 0 Left = 2
Height = 26 Height = 26
Top = 0 Top = 2
Width = 901 Width = 897
AutoSize = True AutoSize = True
BorderSpacing.Around = 2
ButtonHeight = 26 ButtonHeight = 26
ButtonWidth = 28 ButtonWidth = 28
Caption = 'ToolBar' Caption = 'ToolBar'
@ -242,11 +243,11 @@ object GridPrintPreviewForm: TGridPrintPreviewForm
Width = 40 Width = 40
Alignment = taCenter Alignment = taCenter
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0
Text = 'edPageNumber'
OnEditingDone = edPageNumberEditingDone OnEditingDone = edPageNumberEditingDone
OnKeyDown = edPageNumberKeyDown OnKeyDown = edPageNumberKeyDown
OnMouseWheel = edPageNumberMouseWheel OnMouseWheel = edPageNumberMouseWheel
TabOrder = 0
Text = 'edPageNumber'
end end
end end
object tbScalePrinter: TToolButton object tbScalePrinter: TToolButton
@ -258,15 +259,15 @@ object GridPrintPreviewForm: TGridPrintPreviewForm
end end
object ScrollBox: TScrollBox object ScrollBox: TScrollBox
Left = 0 Left = 0
Height = 623 Height = 619
Top = 26 Top = 30
Width = 901 Width = 901
HorzScrollBar.Page = 98 HorzScrollBar.Page = 98
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Page = 98 VertScrollBar.Page = 98
VertScrollBar.Tracking = True VertScrollBar.Tracking = True
Align = alClient Align = alClient
ClientHeight = 619 ClientHeight = 615
ClientWidth = 897 ClientWidth = 897
Color = clAppWorkspace Color = clAppWorkspace
ParentBackground = False ParentBackground = False