Solved

Disable quick report preview save/load button

Posted on 2002-06-18
6
1,659 Views
Last Modified: 2012-06-27
Hi,

I need to know how to disable quick report save/load button in preview mode.

Thanks.

JL
0
Comment
Question by:jlislo
6 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7091532
Create your own preview, here's a quick example:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  QRPrntr, ExtCtrls, QuickRpt, Db, DBTables, ComCtrls, ToolWin, Qrctrls,
  StdCtrls, ActnList, Spin;

type
  TForm1 = class(TForm)
    QuickRep1: TQuickRep;
    QRPreview1: TQRPreview;
    Table1: TTable;
    DetailBand1: TQRBand;
    QRDBText1: TQRDBText;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    ActionList1: TActionList;
    actPrevPage: TAction;
    actNextPage: TAction;
    SpinEdit1: TSpinEdit;
    procedure QuickRep1Preview(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure actPrevPageUpdate(Sender: TObject);
    procedure actPrevPageExecute(Sender: TObject);
    procedure actNextPageUpdate(Sender: TObject);
    procedure actNextPageExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.QuickRep1Preview(Sender: TObject);
begin
  QRPreview1.QRPrinter := TQRPrinter(Sender);
end;

procedure TForm1.ToolButton1Click(Sender: TObject);
begin
  QuickRep1.Preview;
end;

procedure TForm1.ToolButton2Click(Sender: TObject);
begin
  QRPreview1.Zoom := SpinEdit1.Value;
end;

procedure TForm1.actPrevPageUpdate(Sender: TObject);
begin
  TAction(Sender).Enabled := Assigned(QuickRep1.QRPrinter) and
    (QRPreview1.PageNumber > 1);
end;

procedure TForm1.actPrevPageExecute(Sender: TObject);
begin
  QRPreview1.PageNumber := QRPreview1.PageNumber - 1;
end;

procedure TForm1.actNextPageUpdate(Sender: TObject);
begin
  TAction(Sender).Enabled := Assigned(QuickRep1.QRPrinter) and
    (QRPreview1.PageNumber < QuickRep1.QRPrinter.PageCount)
end;

procedure TForm1.actNextPageExecute(Sender: TObject);
begin
  QRPreview1.PageNumber := QRPreview1.PageNumber + 1;
end;

end.
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7091535
And here's the form (change the database to the one you want):

object Form1: TForm1
  Left = 192
  Top = 106
  AutoScroll = False
  Caption = 'Form1'
  ClientHeight = 453
  ClientWidth = 688
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Scaled = False
  PixelsPerInch = 96
  TextHeight = 13
  object QuickRep1: TQuickRep
    Left = 8
    Top = 8
    Width = 794
    Height = 1123
    Frame.Color = clBlack
    Frame.DrawTop = False
    Frame.DrawBottom = False
    Frame.DrawLeft = False
    Frame.DrawRight = False
    DataSet = Table1
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Arial'
    Font.Style = []
    Functions.Strings = (
      'PAGENUMBER'
      'COLUMNNUMBER'
      'REPORTTITLE')
    Functions.DATA = (
      '0'
      '0'
      #39#39)
    OnPreview = QuickRep1Preview
    Options = [FirstPageHeader, LastPageFooter]
    Page.Columns = 1
    Page.Orientation = poPortrait
    Page.PaperSize = A4
    Page.Values = (
      127
      2970
      127
      2100
      127
      127
      0)
    PrinterSettings.Copies = 1
    PrinterSettings.Duplex = False
    PrinterSettings.FirstPage = 0
    PrinterSettings.LastPage = 0
    PrinterSettings.OutputBin = Auto
    PrintIfEmpty = True
    SnapToGrid = True
    Units = Inches
    Zoom = 100
    object DetailBand1: TQRBand
      Left = 48
      Top = 48
      Width = 698
      Height = 40
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      AlignToBottom = False
      Color = clWhite
      ForceNewColumn = False
      ForceNewPage = False
      Size.Values = (
        105.833333333333
        1846.79166666667)
      BandType = rbDetail
      object QRDBText1: TQRDBText
        Left = 0
        Top = 8
        Width = 63
        Height = 17
        Frame.Color = clBlack
        Frame.DrawTop = False
        Frame.DrawBottom = False
        Frame.DrawLeft = False
        Frame.DrawRight = False
        Size.Values = (
          44.9791666666667
          0
          21.1666666666667
          166.6875)
        Alignment = taLeftJustify
        AlignToBand = True
        AutoSize = True
        AutoStretch = False
        Color = clWhite
        DataSet = Table1
        DataField = 'Adr_Street'
        Transparent = False
        WordWrap = True
        FontSize = 10
      end
    end
  end
  object QRPreview1: TQRPreview
    Left = 0
    Top = 29
    Width = 688
    Height = 424
    HorzScrollBar.Tracking = True
    VertScrollBar.Tracking = True
    Align = alClient
    TabOrder = 1
    PageNumber = 1
    Zoom = 100
  end
  object ToolBar1: TToolBar
    Left = 0
    Top = 0
    Width = 688
    Height = 29
    ButtonHeight = 21
    ButtonWidth = 76
    Caption = 'ToolBar1'
    ShowCaptions = True
    TabOrder = 2
    object ToolButton1: TToolButton
      Left = 0
      Top = 2
      Caption = 'Preview'
      ImageIndex = 0
      OnClick = ToolButton1Click
    end
    object SpinEdit1: TSpinEdit
      Left = 76
      Top = 2
      Width = 59
      Height = 22
      MaxLength = 25
      MaxValue = 1000
      MinValue = 25
      TabOrder = 0
      Value = 100
    end
    object ToolButton2: TToolButton
      Left = 135
      Top = 2
      Caption = 'Zoom'
      ImageIndex = 1
      OnClick = ToolButton2Click
    end
    object ToolButton3: TToolButton
      Left = 211
      Top = 2
      Action = actPrevPage
    end
    object ToolButton4: TToolButton
      Left = 287
      Top = 2
      Action = actNextPage
    end
  end
  object Table1: TTable
    Active = True
    DatabaseName = 'Demo'
    TableName = 'Address'
    Left = 32
    Top = 320
  end
  object ActionList1: TActionList
    Left = 34
    Top = 63
    object actPrevPage: TAction
      Caption = 'Previous Page'
      OnExecute = actPrevPageExecute
      OnUpdate = actPrevPageUpdate
    end
    object actNextPage: TAction
      Caption = 'Next Page'
      OnExecute = actNextPageExecute
      OnUpdate = actNextPageUpdate
    end
  end
end











HTH
DragonSlayer
0
 

Expert Comment

by:penich
ID: 7091721
Build your Qreport into a form and control the Qreport programmatically
it will help you in furute if you have any other requriments
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:jlislo
ID: 7092438
DragonSlayer,

I already have a prrview form designed for another project. What I want to know is any quick way to disable only the save/load function. Thanks.

JL
0
 

Accepted Solution

by:
jlislo earned 0 total points
ID: 7093148
I think I find the answer.

Open \Program Files\Borland\Delphi6\Lib\Qrprev.dfm w/ Delphi

add "Enabled = False"
the following two object

    object SaveReport: TToolButton
      Left = 239
      Top = 0
      Hint = 'Save Report'
      Caption = 'PrintSetup'
      ImageIndex = 10
      Enabled = False
      OnClick = SaveClick
    end
    object LoadReport: TToolButton
      Left = 262
      Top = 0
      Hint = 'Load Report'
      Caption = 'Print'
      ImageIndex = 9
      Enabled = False
      OnClick = LoadClick
    end
0
 

Expert Comment

by:CleanupPing
ID: 9343184
jlislo:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now