Options Unit

The code of the options unit

unit Options;
{
    Copyright (c) 2013 Jerzy Griffiths

    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License, as described at
    http://www.apache.org/licenses/ and http://www.pp4s.co.uk/licenses/ }
 
interface

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

type
  TOptions_frm = class(TForm)
    Back: TButton;
    Label1: TLabel;
    Total_written_radio: TRadioButton;
    Left_radio: TRadioButton;
    Save: TButton;
    procedure BackClick(Sender: TObject);
    procedure SaveClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    General_options: boolean;
    File_path: string;
    Progress_deadline: integer;
    { Public declarations }
  end;

var
  Options_frm: TOptions_frm;

implementation

uses
  main_menu;

{$R *.dfm}

procedure TOptions_frm.BackClick(Sender: TObject);
begin
  main_menu_frm.Show;
  options_frm.Hide;
end;

procedure TOptions_frm.FormShow(Sender: TObject);
begin
  File_path := Main_menu_frm.path + '\General\options.ini';
end;

procedure TOptions_frm.SaveClick(Sender: TObject);
var
  Ini: tinifile;
  number: integer;
begin
  if total_written_radio.Checked then
    number := 1;
  if left_radio.Checked then
    number := 2;
  Ini := tinifile.Create(File_path);
  Ini.writeinteger('Main section', 'Progress bar', number);
  progress_deadline := number;
end;

end.
Programming - a skill for life!

by Jerzy Griffiths: L6 Age ~17