home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / Chip_2003-01_cd1.bin / zkuste / delphi / kompon / D34567 / SMDBG / SMGRDEMO.ZIP / Main.pas < prev   
Pascal/Delphi Source File  |  2000-03-13  |  3KB  |  117 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Grids, DBGrids, SMDBGrid, ExtCtrls, Db, DBTables, ComCtrls;
  8.  
  9. type
  10.   TfrmMain = class(TForm)
  11.     pcMain: TPageControl;
  12.     tsBoolean: TTabSheet;
  13.     SMDBGridBoolean: TSMDBGrid;
  14.     dSrcReservat: TDataSource;
  15.     tblReservat: TTable;
  16.     tsStandardPopup: TTabSheet;
  17.     SMDBGridStandardPopup: TSMDBGrid;
  18.     tsFixed: TTabSheet;
  19.     SMDBGridFixed: TSMDBGrid;
  20.     tblReservatResNo: TAutoIncField;
  21.     tblReservatEventNo: TIntegerField;
  22.     tblReservatCustNo: TIntegerField;
  23.     tblReservatNumTickets: TIntegerField;
  24.     tblReservatAmt_Paid: TCurrencyField;
  25.     tblReservatPay_Method: TStringField;
  26.     tblReservatCard_No: TStringField;
  27.     tblReservatCard_Exp: TDateField;
  28.     tblReservatPay_Notes: TMemoField;
  29.     tblReservatPurge_Date: TDateField;
  30.     tblReservatPaid: TBooleanField;
  31.     tsMultiSelect: TTabSheet;
  32.     SMDBGridMultiSelect: TSMDBGrid;
  33.     tsGlyph: TTabSheet;
  34.     imgGlyph1: TImage;
  35.     imgGlyph2: TImage;
  36.     tsLookup: TTabSheet;
  37.     SMDBGridLookup: TSMDBGrid;
  38.     tblCustomer: TTable;
  39.     tsGraphics: TTabSheet;
  40.     tblBiolife: TTable;
  41.     dSrcBiolife: TDataSource;
  42.     tblBiolifeSpeciesNo: TFloatField;
  43.     tblBiolifeCategory: TStringField;
  44.     tblBiolifeCommon_Name: TStringField;
  45.     tblBiolifeSpeciesName: TStringField;
  46.     tblBiolifeLengthcm: TFloatField;
  47.     tblBiolifeLength_In: TFloatField;
  48.     tblBiolifeNotes: TMemoField;
  49.     tblBiolifeGraphic: TGraphicField;
  50.     SMDBGridGraphic1: TSMDBGrid;
  51.     tsNoAppendDelete: TTabSheet;
  52.     SMDBGridNoAppendDelete: TSMDBGrid;
  53.     tsColors: TTabSheet;
  54.     SMDBGridColors: TSMDBGrid;
  55.     SMDBGridGlyph: TSMDBGrid;
  56.     SMDBGridGraphic2: TSMDBGrid;
  57.     Splitter1: TSplitter;
  58.     tsSort: TTabSheet;
  59.     SMDBGridSort: TSMDBGrid;
  60.     tsEnterLikeTab: TTabSheet;
  61.     SMDBGridEnterLikeTab: TSMDBGrid;
  62.     tsMultilined: TTabSheet;
  63.     SMDBGrid1: TSMDBGrid;
  64.     procedure SMDBGridGlyphGetGlyph(Sender: TObject; var Bitmap: TBitmap);
  65.     procedure SMDBGridColorsGetCellParams(Sender: TObject; Field: TField;
  66.       AFont: TFont; var Background: TColor; Highlight: Boolean);
  67.     procedure pcMainChange(Sender: TObject);
  68.   private
  69.     { Private declarations }
  70.   public
  71.     { Public declarations }
  72.   end;
  73.  
  74. var
  75.   frmMain: TfrmMain;
  76.  
  77. implementation
  78.  
  79. {$R *.DFM}
  80.  
  81. procedure TfrmMain.SMDBGridGlyphGetGlyph(Sender: TObject;
  82.   var Bitmap: TBitmap);
  83. begin
  84.   if tblReservat.FieldByName('Paid').AsBoolean then
  85.     Bitmap := imgGlyph1.Picture.Bitmap
  86.   else
  87.     Bitmap := imgGlyph2.Picture.Bitmap
  88. end;
  89.  
  90. procedure TfrmMain.SMDBGridColorsGetCellParams(Sender: TObject;
  91.   Field: TField; AFont: TFont; var Background: TColor; Highlight: Boolean);
  92. begin
  93.   if tblReservat.RecNo mod 2 = 0 then
  94.     Background := cl3DLight
  95. end;
  96.  
  97. procedure TfrmMain.pcMainChange(Sender: TObject);
  98. begin
  99.   with SMDBGridSort do
  100.   begin
  101.     DataSource.DataSet.DisableControls;
  102.  
  103.     {clear the all sorted columns}
  104.     SortColumns.Clear;
  105.  
  106.     with SortColumns.Add do
  107.     begin
  108.       FieldName := tblReservat.IndexFieldNames;
  109.       SortType := stAscending
  110.     end;
  111.  
  112.     DataSource.DataSet.EnableControls;
  113.   end
  114. end;
  115.  
  116. end.
  117.