Solved

Disable quick report preview save/load button

Posted on 2002-06-18
6
1,751 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

615 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