{ *********************************************************************** }
{                                                                         }
{ Copular Chat Client v3.0 Source Code                                    }
{ Logon Form Unit                                                         }
{                                                                         }
{ Copyright (c) 1998-2002 SAF Studio                                      }
{                                                                         }
{ Author  : Niu Yu Ping                                                   }
{ Nickname: DecimalOX                                                     }
{ Address : Jilin City China                                              }
{                                                                         }
{ QICQ    : 103106262                                                     }
{ Homepage: www.safree.com                                                }
{ EMail   : decimalox@sohu.com                                            }
{                                                                         }
{ *********************************************************************** }

unit logon;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, KsGroupBoxs, KsSkinGroupBoxs, KsControls, KsButtons,
  KsSkinButtons, KsSkinEngine, KsHooks, KsForms, KsSkinForms, ExtCtrls;

type
  TLogonForm = class(TForm)
    LogonBtn: TSeSkinButton;
    ExitBtn: TSeSkinButton;
    SeSkinGroupBox1: TSeSkinGroupBox;
    NickName: TEdit;
    Password: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    MoveTimer: TTimer;
    SeSkinForm1: TSeSkinForm;
    procedure LogonBtnClick(Sender: TObject);
    procedure ExitBtnClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure MoveTimerTimer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  LogonForm: TLogonForm;

implementation

{$R *.DFM}

uses
  Main;
  
procedure TLogonForm.LogonBtnClick(Sender: TObject);
begin
  ModalResult:=mrNone;
  if (NickName.Text<>'') and (Password.Text<>'') then
    ModalResult:=mrOK;
end;

procedure TLogonForm.ExitBtnClick(Sender: TObject);
begin
  ModalResult:=mrCancel;
end;

procedure TLogonForm.FormCreate(Sender: TObject);
begin
  //Set form position and begin moving from bottom to center
  Top:=Screen.Height;
  Width:=Screen.Width div 2 - Width div 2;
  MoveTimer.Enabled:=True;
end;

//Move form from bottom to center
procedure TLogonForm.MoveTimerTimer(Sender: TObject);
begin
  Top:=Top-20;
  if Top<=Screen.Height div 2 - Height div 2 then
  begin
    Top:=Screen.Height div 2 - Height div 2;
    MoveTimer.Enabled:=False;
  end;
end;

end.
