Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 6

Chapter 23 - Project MapTable

Project Structure

MapTable.dpr
program MapTable;

uses
  Forms,
  MapTblForm in 'MapTblForm.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
MapTblForm.pas
unit MapTblForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, xmldom, StdCtrls, Grids, DBGrids, Xmlxform,
  DBClient, Provider, XMLDoc, ComCtrls;

type
  TForm1 = class(TForm)
    Table1: TTable;
    DataSetProvider1: TDataSetProvider;
    ClientDataSet1: TClientDataSet;
    DataSetProvider2: TDataSetProvider;
    XMLTransformClient1: TXMLTransformClient;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    btnMap: TButton;
    Memo1: TMemo;
    procedure btnMapClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnMapClick(Sender: TObject);
begin
  Memo1.Lines.Text := FormatXmlData (XMLTransformClient1.GetDataAsXml(''));
end;

end.
MapTblForm.dfm
object Form1: TForm1
  Left = 227
  Top = 222
  Width = 613
  Height = 438
  Caption = 'MapTable'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  DesignSize = (
    605
    411)
  PixelsPerInch = 96
  TextHeight = 13
  object DBGrid1: TDBGrid
    Left = 8
    Top = 8
    Width = 589
    Height = 169
    Anchors = [akLeft, akTop, akRight]
    DataSource = DataSource1
    TabOrder = 0
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
  end
  object btnMap: TButton
    Left = 8
    Top = 184
    Width = 588
    Height = 25
    Anchors = [akLeft, akTop, akRight]
    Caption = 'Map'
    TabOrder = 1
    OnClick = btnMapClick
  end
  object Memo1: TMemo
    Left = 8
    Top = 216
    Width = 588
    Height = 192
    Anchors = [akLeft, akTop, akRight, akBottom]
    TabOrder = 2
  end
  object Table1: TTable
    Active = True
    DatabaseName = 'DBDEMOS'
    TableName = 'customer.db'
    Left = 24
    Top = 24
  end
  object DataSetProvider1: TDataSetProvider
    DataSet = Table1
    Constraints = True
    Left = 24
    Top = 80
  end
  object ClientDataSet1: TClientDataSet
    Active = True
    Aggregates = <>
    Params = <>
    ProviderName = 'DataSetProvider1'
    Left = 32
    Top = 136
  end
  object DataSetProvider2: TDataSetProvider
    DataSet = ClientDataSet1
    Constraints = True
    Left = 32
    Top = 192
  end
  object XMLTransformClient1: TXMLTransformClient
    ProviderName = 'DataSetProvider2'
    TransformGetData.TransformationFile = 'C:\md6code\23\MapTable\CustomersToXml.xtr'
    Left = 32
    Top = 256
  end
  object DataSource1: TDataSource
    DataSet = ClientDataSet1
    Left = 104
    Top = 136
  end
end