source: cprs/branches/tmg-cprs/dklang-package-3.01/Examples/MDI/Main.pas@ 1806

Last change on this file since 1806 was 468, checked in by Kevin Toppenberg, 16 years ago

CPRS v1.0.26.76

File size: 2.3 KB
Line 
1//**********************************************************************************************************************
2// $Id: Main.pas,v 1.5 2006/08/11 12:15:50 dale Exp $
3//----------------------------------------------------------------------------------------------------------------------
4// DKLang Localization Package
5// Copyright (c)DK Software, http://www.dk-soft.org/
6//**********************************************************************************************************************
7unit Main;
8
9interface
10
11uses
12 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TntForms,
13 DKLang, StdCtrls, TntStdCtrls, ExtCtrls, TntExtCtrls;
14
15type
16 TfMain = class(TTntForm)
17 bCascade: TTntButton;
18 bNewWindow: TTntButton;
19 bTile: TTntButton;
20 cbLanguage: TTntComboBox;
21 lcMain: TDKLanguageController;
22 pTop: TTntPanel;
23 procedure bCascadeClick(Sender: TObject);
24 procedure bNewWindowClick(Sender: TObject);
25 procedure bTileClick(Sender: TObject);
26 procedure cbLanguageChange(Sender: TObject);
27 procedure FormCreate(Sender: TObject);
28 end;
29
30var
31 fMain: TfMain;
32
33implementation
34{$R *.dfm}
35uses TntSystem, TntSysUtils, ufMDIChild;
36
37 procedure TfMain.bCascadeClick(Sender: TObject);
38 begin
39 Cascade;
40 end;
41
42 procedure TfMain.bNewWindowClick(Sender: TObject);
43 begin
44 TfMDIChild.Create(Self);
45 end;
46
47 procedure TfMain.bTileClick(Sender: TObject);
48 begin
49 Tile;
50 end;
51
52 procedure TfMain.cbLanguageChange(Sender: TObject);
53 var iIndex: Integer;
54 begin
55 iIndex := cbLanguage.ItemIndex;
56 if iIndex<0 then iIndex := 0; // When there's no valid selection in cbLanguage we use the default language (Index=0)
57 LangManager.LanguageID := LangManager.LanguageIDs[iIndex];
58 end;
59
60 procedure TfMain.FormCreate(Sender: TObject);
61 var i: Integer;
62 begin
63 // Scan for language files in the app directory and register them in the LangManager object
64 LangManager.ScanForLangFiles(WideExtractFileDir(WideParamStr(0)), '*.lng', False);
65 // Fill cbLanguage with available languages
66 for i := 0 to LangManager.LanguageCount-1 do cbLanguage.Items.Add(LangManager.LanguageNames[i]);
67 // Index=0 always means the default language
68 cbLanguage.ItemIndex := 0;
69 end;
70
71end.
Note: See TracBrowser for help on using the repository browser.