Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Delphi 2009 Handbook

Project: CheckBoxHeader.dproj

Project Structure

CheckBoxHeader.dpr
program CheckBoxHeader;

uses
  Forms,
  CheckBoxHeader_MainForm in 'CheckBoxHeader_MainForm.pas' {FormCheckBoxHeader};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TFormCheckBoxHeader, FormCheckBoxHeader);
  Application.Run;
end.
CheckBoxHeader_MainForm.pas
unit CheckBoxHeader_MainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls;

type
  TFormCheckBoxHeader = class(TForm)
    HeaderControl1: THeaderControl;
    Memo1: TMemo;
    procedure HeaderControl1SectionCheck(HeaderControl: TCustomHeaderControl;
      Section: THeaderSection);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormCheckBoxHeader: TFormCheckBoxHeader;

implementation

{$R *.dfm}

uses
  StrUtils;

procedure TFormCheckBoxHeader.HeaderControl1SectionCheck(
  HeaderControl: TCustomHeaderControl; Section: THeaderSection);
begin
  Memo1.Lines.Add (Section.Text +
    IfThen (Section.Checked, ' checked', ' unchecked'));
end;

end.
CheckBoxHeader_MainForm.pas.dfm
object FormCheckBoxHeader: TFormCheckBoxHeader
  Left = 0
  Top = 0
  Caption = 'CheckBoxHeader'
  ClientHeight = 179
  ClientWidth = 283
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object HeaderControl1: THeaderControl
    Left = 0
    Top = 0
    Width = 283
    Height = 25
    Sections = <
      item
        AutoSize = True
        CheckBox = True
        ImageIndex = -1
        Text = 'one'
        Width = 73
      end
      item
        AutoSize = True
        CheckBox = True
        Checked = True
        ImageIndex = -1
        Text = 'two'
        Width = 70
      end
      item
        AutoSize = True
        CheckBox = True
        ImageIndex = -1
        Text = 'three'
        Width = 70
      end
      item
        AutoSize = True
        CheckBox = True
        ImageIndex = -1
        Text = 'four'
        Width = 70
      end>
    OnSectionCheck = HeaderControl1SectionCheck
    CheckBoxes = True
  end
  object Memo1: TMemo
    Left = 0
    Top = 25
    Width = 283
    Height = 154
    Align = alClient
    Lines.Strings = (
      'Memo1')
    TabOrder = 1
  end
end
HTML file generated by PasToWeb, a tool by Marco Cantù
Copyright 2008 Marco Cantù