Marco Web Center |
Home: Code Repository: Mastering Delphi 5Project GRIDDEMO
Project StructureGRIDDEMO.DPRprogram GridDemo; uses Forms, GridF in 'GridF.pas' {Form1}; {$R *.RES} begin Application.CreateForm(TForm1, Form1); Application.Run; end. GRIDF.PASunit GridF; interface uses SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, DBTables; type TForm1 = class(TForm) Table1: TTable; DataSource1: TDataSource; DBGrid1: TDBGrid; procedure DataSource1StateChange(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.DataSource1StateChange(Sender: TObject); var Title: string; begin case Table1.State of dsBrowse: Title := 'Browse'; dsEdit: Title := 'Edit'; dsInsert: Title := 'Insert'; else Title := 'Other state'; end; Caption := 'Grid Demo - ' + Title; end; end. GRIDF.DFMobject Form1: TForm1 Left = 449 Top = 141 Width = 499 Height = 311 ActiveControl = DBGrid1 Caption = 'Grid Demo' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = True PixelsPerInch = 96 TextHeight = 13 object DBGrid1: TDBGrid Left = 0 Top = 0 Width = 491 Height = 284 Align = alClient DataSource = DataSource1 TabOrder = 0 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clBlack TitleFont.Height = -11 TitleFont.Name = 'MS Sans Serif' TitleFont.Style = [] Columns = < item Alignment = taRightJustify Color = clBtnShadow Expanded = False FieldName = 'Name' Font.Charset = DEFAULT_CHARSET Font.Color = clWhite Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ReadOnly = True Title.Alignment = taRightJustify Title.Caption = 'Country' Title.Font.Charset = DEFAULT_CHARSET Title.Font.Color = clBlack Title.Font.Height = -11 Title.Font.Name = 'MS Sans Serif' Title.Font.Style = [fsBold] Width = 133 Visible = True end item Expanded = False FieldName = 'Capital' Width = 83 Visible = True end item Expanded = False FieldName = 'Continent' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsItalic] PickList.Strings = ( 'Africa' 'Asia' 'Australia' 'Europe' 'North America' 'South America') Width = 95 Visible = True end item Expanded = False FieldName = 'Area' Width = 72 Visible = True end item Expanded = False FieldName = 'Population' Visible = True end> end object Table1: TTable Active = True DatabaseName = 'DBDEMOS' TableName = 'COUNTRY.DB' Left = 24 Top = 144 end object DataSource1: TDataSource DataSet = Table1 OnStateChange = DataSource1StateChange Left = 80 Top = 144 end end
|
||
© Copyright Marco Cantù, 1995-2020, All rights reserved |