Changeset 12 for trunk/Forms


Ignore:
Timestamp:
Jun 9, 2011, 1:04:45 PM (13 years ago)
Author:
george
Message:
  • Fixed: Display edit controls according property type.
  • Added: Interface language translation.
Location:
trunk/Forms
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemAdd.lfm

    r9 r12  
    1212  OnDestroy = FormDestroy
    1313  OnShow = FormShow
    14   LCLVersion = '0.9.29'
     14  LCLVersion = '0.9.31'
    1515  object Panel1: TPanel
    1616    Left = 0
  • trunk/Forms/UItemAdd.lrt

    r7 r12  
    1 TITEMADDFORM.ITEMADDFORM.CAPTION=Add item
     1TITEMADDFORM.CAPTION=Add item
    22TITEMADDFORM.BUTTONCANCEL.CAPTION=Cancel
    33TITEMADDFORM.BUTTONSAVE.CAPTION=Add
  • trunk/Forms/UItemAdd.pas

    r9 r12  
    103103      TLabel(NewControl).Caption := TReportColumn(Report.Columns[I]).Caption + ':';
    104104
    105       ValueType := TReportColumn(Report.Columns[I]).TypeId;
     105      ValueType := TReportColumn(Report.Columns[I]).TypeDef.TypeIndex;
    106106      if ValueType = Integer(vtInteger) then begin
    107107        NewControl := TSpinEdit.Create(Panel1);
  • trunk/Forms/UItemEdit.lfm

    r9 r12  
    1212  OnDestroy = FormDestroy
    1313  OnShow = FormShow
    14   LCLVersion = '0.9.29'
     14  LCLVersion = '0.9.31'
    1515  object Panel1: TPanel
    1616    Left = 0
  • trunk/Forms/UItemEdit.lrt

    r7 r12  
    1 TITEMEDITFORM.ITEMEDITFORM.CAPTION=Edit item
     1TITEMEDITFORM.CAPTION=Edit item
    22TITEMEDITFORM.BUTTONCANCEL.CAPTION=Cancel
    33TITEMEDITFORM.BUTTONSAVE.CAPTION=Save
  • trunk/Forms/UItemEdit.pas

    r9 r12  
    106106      TLabel(NewControl).Caption := TReportColumn(Report.Columns[I]).Caption + ':';
    107107
    108       ValueType := TReportColumn(Report.Columns[I]).TypeId;
     108      ValueType := TReportColumn(Report.Columns[I]).TypeDef.TypeIndex;
    109109      if ValueType = Integer(vtInteger) then begin
    110110        NewControl := TSpinEdit.Create(Panel1);
  • trunk/Forms/UItemView.lfm

    r9 r12  
    1111  OnDestroy = FormDestroy
    1212  OnShow = FormShow
    13   LCLVersion = '0.9.29'
     13  LCLVersion = '0.9.31'
    1414  object ButtonClose: TButton
    1515    Left = 546
  • trunk/Forms/UItemView.lrt

    r7 r12  
    1 TITEMVIEWFORM.ITEMVIEWFORM.CAPTION=View item
     1TITEMVIEWFORM.CAPTION=View item
    22TITEMVIEWFORM.BUTTONCLOSE.CAPTION=Close
    33TITEMVIEWFORM.BUTTONEDIT.CAPTION=Edit
  • trunk/Forms/UItemView.pas

    r9 r12  
    108108  if Report.Count = 1 then
    109109  for I := 0 to Report.Columns.Count - 1 do
    110   if TReportColumn(Report.Columns[I]).TypeId = 20 then begin
     110  if TReportColumn(Report.Columns[I]).TypeDef.TypeIndex = Integer(vtPointer) then begin
    111111    TabControl1.Tabs.Add(TReportColumn(Report.Columns[I]).Caption);
    112112  end else begin
  • trunk/Forms/UMainForm.pas

    r11 r12  
    121121
    122122uses
    123   UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo;
     123  UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo,
     124  UCore;
    124125
    125126{$R *.lfm}
     
    138139    System.Database.UserName := ReadStringWithDefault('DatabaseUserName', 'chronis');
    139140    System.Database.Password := ReadStringWithDefault('DatabasePassword', '');
    140   finally
     141    with Core.CoolTranslator1 do
     142      Language := Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''));
     143 finally
    141144    Free;
    142145  end;
     
    154157    WriteString('DatabaseUserName', System.Database.UserName);
    155158    WriteString('DatabasePassword', System.Database.Password);
     159    with Core.CoolTranslator1 do
     160      WriteString('LanguageCode', Language.Code);
    156161  finally
    157162    Free;
     
    434439  System.Database.Connect;
    435440  InitStructure;
     441  System.LoadTypes;
    436442  LoadTree;
    437443end;
  • trunk/Forms/USettingForm.lfm

    r10 r12  
    77  ClientHeight = 328
    88  ClientWidth = 446
     9  OnClose = FormClose
     10  OnShow = FormShow
    911  LCLVersion = '0.9.31'
    1012  object Label1: TLabel
     
    4345    TabOrder = 2
    4446  end
     47  object Label2: TLabel
     48    Left = 9
     49    Height = 14
     50    Top = 38
     51    Width = 52
     52    Caption = 'Language:'
     53    ParentColor = False
     54  end
     55  object ComboBoxLanguage: TComboBox
     56    Left = 116
     57    Height = 21
     58    Top = 32
     59    Width = 132
     60    ItemHeight = 13
     61    TabOrder = 3
     62    Text = 'ComboBoxLanguage'
     63  end
    4564end
  • trunk/Forms/USettingForm.lrt

    r10 r12  
    33TSETTINGFORM.BUTTONSAVE.CAPTION=Save
    44TSETTINGFORM.BUTTONCANCEL.CAPTION=Cancel
     5TSETTINGFORM.LABEL2.CAPTION=Language:
     6TSETTINGFORM.COMBOBOXLANGUAGE.TEXT=ComboBoxLanguage
  • trunk/Forms/USettingForm.pas

    r10 r12  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
     8  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
     9  CoolTranslator, ULanguages;
    910
    1011type
     
    1516    ButtonSave: TButton;
    1617    ButtonCancel: TButton;
     18    ComboBoxLanguage: TComboBox;
    1719    Edit1: TEdit;
    1820    Label1: TLabel;
     21    Label2: TLabel;
     22    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     23    procedure FormShow(Sender: TObject);
    1924  private
    20     { private declarations }
     25    procedure Save;
     26    procedure Load;
    2127  public
    2228    { public declarations }
     
    3036{$R *.lfm}
    3137
     38uses
     39  UCore, UMainForm;
     40
     41{ TSettingForm }
     42
     43procedure TSettingForm.FormShow(Sender: TObject);
     44begin
     45  MainForm.PersistentForm.Load(Self);
     46
     47  Load;
     48end;
     49
     50procedure TSettingForm.FormClose(Sender: TObject; var CloseAction: TCloseAction
     51  );
     52begin
     53  if ModalResult = mrOK then Save;
     54  MainForm.PersistentForm.Save(Self);
     55end;
     56
     57procedure TSettingForm.Save;
     58begin
     59  with Core.CoolTranslator1 do
     60    Language := TLanguage(Languages[ComboBoxLanguage.ItemIndex]);
     61end;
     62
     63procedure TSettingForm.Load;
     64begin
     65  with Core.CoolTranslator1 do begin
     66    LanguageListToStrings(ComboBoxLanguage.Items);
     67    if Assigned(Language) then begin
     68      ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Language);
     69      // Select automatic if no other match
     70      if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     71    end else ComboBoxLanguage.ItemIndex := 0;
     72  end;
     73end;
     74
    3275end.
    3376
Note: See TracChangeset for help on using the changeset viewer.