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
Solved

Disable quick report preview save/load button

Posted on 2002-06-18
6
1,699 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
Print Graphic and Text to Epson TM-T88v 12 366
Dev Express grid collapse 2 45
Controlled Assessment GCSE - desperate help needed 4 98
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

791 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