日別アーカイブ: 2014年8月6日

ヘルプフォーム


unit untFormHelp;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
  System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
  FMX.StdCtrls, FMX.TabControl, FMX.Objects, FMX.Layouts;

type
  TfrmHelp = class(TForm)
    tbcHelp: TTabControl;
    TabItem1: TTabItem;
    TabItem2: TTabItem;
    TabItem3: TTabItem;
    TabItem4: TTabItem;
    Image1: TImage;
    Label1: TLabel;
    Image2: TImage;
    VertScrollBox1: TVertScrollBox;
    VertScrollBox2: TVertScrollBox;
    Image3: TImage;
    VertScrollBox3: TVertScrollBox;
    Image4: TImage;
    Layout1: TLayout;
    Button0: TButton;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Layout2: TLayout;
    btnClose: TButton;
    Layout3: TLayout;
    Layout4: TLayout;
    Layout5: TLayout;
    Layout6: TLayout;
    TabItem5: TTabItem;
    procedure FormCreate(Sender: TObject);
    procedure Button0Click(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
    const
      PAGE_COUNT = 5;
  private

    FButton: array[0..PAGE_COUNT-1] of TButton;
    procedure setPageIndex(const Value: Integer);

  public
    property PageIndex: Integer write setPageIndex;
  end;

var
  frmHelp: TfrmHelp;


implementation

uses
  untMainForm;



{$R *.fmx}

procedure TfrmHelp.btnCloseClick(Sender: TObject);
begin
  self.Close;
end;

procedure TfrmHelp.Button0Click(Sender: TObject);
begin
  PageIndex := TButton(Sender).Tag;
end;

procedure TfrmHelp.FormCreate(Sender: TObject);
begin
  FButton[0] := Button0;
  FButton[1] := Button1;
  FButton[2] := Button2;
  FButton[3] := Button3;
  FButton[4] := Button4;


  tbcHelp.TabPosition := TTabPosition.tpNone;
  PageIndex := 0;
end;

procedure TfrmHelp.setPageIndex(const Value: Integer);
var
  i: Integer;
begin
  for i := 0 to PAGE_COUNT - 1 do
    if i <> Value then
      FButton[i].IsPressed := False
    else
      FButton[i].IsPressed := True;

  tbcHelp.TabIndex := Value;
end;

end.