Solved

Disable quick report preview save/load button

Posted on 2002-06-18
6
1,692 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 98
error 1.1 400 Bad request idhttp delphi 18 87
LAN or WAN ? 11 91
Multi-layered image in FireMonkey 9 34
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 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