unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids, IniFiles,
  DBTables;

type
  TForm3 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    DBGrid1: TDBGrid;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    UpDown1: TUpDown;
    Button1: TButton;
    Bevel1: TBevel;
    ComboBox2: TComboBox;
    DBNavigator2: TDBNavigator;
    CheckBox1: TCheckBox;
    Label3: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Label4: TLabel;
    Edit2: TEdit;
    UpDown2: TUpDown;
    procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure UpDown2Click(Sender: TObject; Button: TUDBtnType);
  private
    { Private 宣言 }
  public
    { Public 宣言 }
  end;

var
  Form3: TForm3;

implementation

uses Unit1, Unit9;

{$R *.dfm}

procedure TForm3.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
        Form1.Panel1.Font.Size:=UpDown1.Position;
        Form1.Panel2.Font.Size:=UpDown1.Position;
        FOrm1.Panel3.Font.Size:=UpDown1.Position;
end;

procedure TForm3.FormCreate(Sender: TObject);
var
  t: TIniFile;
begin
  with Form1 do
  begin
  if (FileExists(Table1.TableName) = true)or(Table1.Exists = true) then
  begin
        Table1.Open;
        OpenDialog1.InitialDir:=ExtractFileDir(Form1.Table1.TableName);
        SaveDialog1.InitialDir:=OpenDialog1.InitialDir;
  end else
  begin
        Showmessage('テーブルが見つかりません');
        N23Click(nil);
    if Table1.Active = false then
    begin
        Form1.Close;
        Exit; 
    end;
  end;
  end;
        t:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'englishdb.ini');
  try
        CheckBox1.Checked:=t.ReadBool('mode','random',false);
        ComboBox1.ItemIndex:=t.ReadInteger('mode','count',0);
        ComboBox2.ItemIndex:=t.ReadInteger('mode','categoly',0);
        ComboBox2Change(nil);
        Form1.Timer1.Interval:=UpDown2.Position;
        Form1.Table1.RecNo:=t.ReadInteger('mode','index',1);
        Form1.Skin:=t.ReadString('skin','name','');
        UpDown1.Position:=t.ReadInteger('mode','font',20);
        UpDown2.Position:=t.ReadInteger('timer','interval',1500);
        OKBottomDlg.CheckBox1.Checked:=t.ReadBool('bookmark','remained',false);
        OKBottomDlg.CheckBox2.Checked:=t.ReadBool('database','readonly',false);
    if t.ReadBool('mode','front',true) = true then
    begin
        RadioButton1.Checked:=true;
    end else
    begin
        RadioButton2.Checked:=true;
    end;
  finally
        t.Free;
  end;
        Caption:=ExtractFileName(Form1.Table1.TableName);
end;

procedure TForm3.Button1Click(Sender: TObject);
begin
        Hide;
end;

procedure TForm3.ComboBox2Change(Sender: TObject);
begin
  if ComboBox2.ItemIndex = 0 then
  begin
        Form1.Table1.Filter:='';
  end else
  begin
        Form1.Table1.Filter:='Categoly = '+QuotedStr(ComboBox2.Text);
  end;
        Form1.RecCount:=Form1.Table1.RecordCount;
        Form1.Table1.First;
        Label3.Caption:='Count: '+IntToStr(Form1.RecCount);
        Form1.Table1AfterScroll(nil);
end;

procedure TForm3.ComboBox1Change(Sender: TObject);
begin
        Form1.Table1AfterScroll(nil);
end;

procedure TForm3.UpDown2Click(Sender: TObject; Button: TUDBtnType);
begin
        Form1.Timer1.Interval:=UpDown2.Position;
end;

end.
