home *** CD-ROM | disk | FTP | other *** search
/ Freelog 11 / Freelog011.iso / BestOf / PhoenixMail / Source / phoenix / FMLanguage.pas < prev    next >
Pascal/Delphi Source File  |  1999-02-05  |  3KB  |  98 lines

  1. {*****************************************************************************
  2.  *
  3.  *  FMLanguage.pas - Select language form  (23-September-1998)
  4.  *
  5.  *  Copyright (c) 1998-99 Michael Haller
  6.  *
  7.  *  Author:     Michael Haller
  8.  *  E-mail:     michael@discountdrive.com
  9.  *  Homepage:   http://www.discountdrive.com/sunrise
  10.  *
  11.  *  This program is free software; you can redistribute it and/or
  12.  *  modify it under the terms of the GNU General Public License
  13.  *  as published by the Free Software Foundation;
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  23.  *
  24.  *----------------------------------------------------------------------------
  25.  *
  26.  *  Revision history:
  27.  *
  28.  *     DATE     REV                 DESCRIPTION
  29.  *  ----------- --- ----------------------------------------------------------
  30.  *
  31.  *****************************************************************************}
  32.  
  33. unit FMLanguage;
  34.  
  35. interface
  36.  
  37. uses
  38.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  39.   StdCtrls, ExtCtrls, PXStuff, Buttons;
  40.  
  41. type
  42.   TLanguageForm = class(TForm)
  43.     Panel1: TPanel;
  44.     RadioGroup1: TRadioGroup;
  45.     Panel2: TPanel;
  46.     Button1: TButton;
  47.     procedure FormCreate(Sender: TObject);
  48.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  49.     procedure FormActivate(Sender: TObject);
  50.   private
  51.     { Private declarations }
  52.   public
  53.     { Public declarations }
  54.     Filename: String;
  55.   end;
  56.  
  57. var
  58.   LanguageForm: TLanguageForm;
  59.  
  60. implementation
  61.  
  62. {$R *.DFM}
  63.  
  64. procedure TLanguageForm.FormCreate(Sender: TObject);
  65. var
  66.   Found: Integer;
  67.   SearchRec: TSearchRec;
  68. begin
  69.   if bOfficeFonts then Font.Name := sOfficeFontName;
  70.   Filename := '';
  71.   Found := FindFirst(sLanguageFolder+'*.lng', faAnyFile, SearchRec);
  72.   while Found = 0 do begin
  73.     RadioGroup1.Items.Add(Copy(SearchRec.Name, 1, Length(SearchRec.Name)-4));
  74.     Found := FindNext(SearchRec);
  75.   end;
  76.   FindClose(SearchRec);
  77.   Panel1.Height := RadioGroup1.Items.Count * 20 + 40;
  78.   ClientHeight := Panel1.Height + Panel2.Height;
  79.   if RadioGroup1.Items.Count = 1 then begin
  80.     bLanguageLoaded := False;
  81.     Filename := sLanguageFolder+RadioGroup1.Items[0]+'.lng';
  82.     ModalResult := mrOK;
  83.   end;
  84. end;
  85.  
  86. procedure TLanguageForm.FormClose(Sender: TObject; var Action: TCloseAction);
  87. begin
  88.   bLanguageLoaded := False;
  89.   Filename := sLanguageFolder+RadioGroup1.Items[RadioGroup1.ItemIndex]+'.lng';
  90. end;
  91.  
  92. procedure TLanguageForm.FormActivate(Sender: TObject);
  93. begin
  94.   RadioGroup1.SetFocus;
  95. end;
  96.  
  97. end.
  98.