[go: up one dir, main page]

Menu

[r22]: / rpmdfsampledata.pas  Maximize  Restore  History

Download this file

126 lines (109 with data), 3.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{*******************************************************}
{ }
{ Report Manager Designer }
{ }
{ rpmdFSampledata }
{ Show data of a unidirectional query }
{ }
{ }
{ Copyright (c) 1994-2002 Toni Martir }
{ toni@pala.com }
{ }
{ This file is under the MPL license }
{ If you enhace this file you must provide }
{ source code }
{ }
{ }
{*******************************************************}
unit rpmdfsampledata;
interface
uses SysUtils, Classes, QGraphics, QForms,
QButtons, QExtCtrls, QControls, QStdCtrls,DB, QDBCtrls, QGrids, QDBGrids,
QComCtrls, QImgList,rpmdconsts;
const
DCONTROL_DISTANCEY=5;
DCONTROL_DISTANCEX=10;
DCONTROL_DISTANCEX2=150;
DCONTROL_WIDTHX=200;
DLABEL_INCY=1;
type
TFRpShowSampledata = class(TForm)
DataSource1: TDataSource;
ToolBar1: TToolBar;
DBNavigator1: TDBNavigator;
ScrollBox1: TScrollBox;
ImageList1: TImageList;
BExit: TToolButton;
ToolButton2: TToolButton;
procedure BExitClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure CreateControls;
public
{ Public declarations }
end;
procedure ShowDataset(Data:TDataset);
implementation
{$R *.xfm}
procedure ShowDataset(Data:TDataset);
var
dia:TFRpShowSampledata;
begin
dia:=TFRpShowSampledata.Create(Application);
try
dia.DataSource1.DataSet:=data;
dia.CreateControls;
dia.ShowModal;
finally
dia.free;
end;
end;
procedure TFRpShowSampledata.CreateControls;
var
i:integer;
dataset:TDataset;
label1:TLabel;
Control:TControl;
top:integer;
begin
if Not Assigned(Datasource1.dataset) then
exit;
if not Datasource1.dataset.active then
exit;
dataset:=Datasource1.dataset;
top:=DCONTROL_DISTANCEY;
for i:=0 to dataset.FieldCount-1 do
begin
label1:=Tlabel.Create(self);
label1.Top:=top+DLABEL_INCY;
label1.Left:=DCONTROL_DISTANCEX;
label1.caption:=Dataset.fields[i].FieldName;
label1.Parent:=ScrollBox1;
control:=TDBTExt.Create(self);
TDBText(control).Font.Style:=[fsBold];
TDBText(control).Datasource:=datasource1;
TDBText(control).DataField:=Dataset.fields[i].FieldName;
control.top:=top;
control.left:=DCONTROL_DISTANCEX2;
control.Width:=DCONTROL_WIDTHX;
control.Height:=Canvas.TextHeight('Wg');
control.parent:=SCrollbox1;
top:=top+Control.Height+DCONTROL_DISTANCEY;
end;
end;
procedure TFRpShowSampledata.BExitClick(Sender: TObject);
begin
Close;
end;
procedure TFRpShowSampledata.FormCreate(Sender: TObject);
begin
Caption:=TranslateStr(735,Caption);
BExit.Hint:=TranslateStr(212,BExit.Caption);
DBNavigator1.Hints.Clear;
DBNavigator1.Hints.Add(TranslateStr(738,''));
DBNavigator1.Hints.Add(TranslateStr(736,''));
DBNavigator1.Hints.Add(TranslateStr(737,''));
SetInitialBounds;
end;
end.