{*****************************************************************************
 *
 *  FMTips.pas - Tip of the day form  (17-August-1998)
 *
 *  Copyright (c) 1998-99 Michael Haller
 *
 *  Author:     Michael Haller
 *  E-mail:     michael@discountdrive.com
 *  Homepage:   http://www.discountdrive.com/sunrise
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation;
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
 *
 *----------------------------------------------------------------------------
 *
 *  Revision history:
 *
 *     DATE     REV                 DESCRIPTION
 *  ----------- --- ----------------------------------------------------------
 *
 *****************************************************************************}

unit FMTips;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  GradForm,
  PXStuff, StdCtrls, ExtCtrls;

type
  TTipsForm = class(TdfsGradientForm)
    Button1: TButton;
    CheckBox1: TCheckBox;
    Button2: TButton;
    Panel3: TPanel;
    Image2: TImage;
    Label1: TLabel;
    Label2: TLabel;
    ListBox1: TListBox;
    procedure FormShow(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  TipsForm: TTipsForm;

implementation

{$R *.DFM}

procedure TTipsForm.FormShow(Sender: TObject);
begin
  if iActualTip < 0 then
    iActualTip := 0;
  if iActualTip > ListBox1.Items.Count - 1 then
    iActualTip := ListBox1.Items.Count - 1;
  CheckBox1.Checked := bShowTips;
  Label1.Caption := ListBox1.Items[iActualTip];
  Inc(iActualTip);
  if iActualTip = ListBox1.Items.Count then
    iActualTip := 0;
end;

procedure TTipsForm.Button2Click(Sender: TObject);
begin
  Label1.Caption := ListBox1.Items[iActualTip];
  Inc(iActualTip);
  if iActualTip = ListBox1.Items.Count then
    iActualTip := 0;
end;

procedure TTipsForm.CheckBox1Click(Sender: TObject);
begin
  bShowTips := CheckBox1.Checked;
end;

procedure TTipsForm.Button1Click(Sender: TObject);
begin
  Close;
end;

initialization
   PMRegistry.AddCustomClass(TTipsForm, 'TTipsForm');

end.
