Changeset 14 for trunk/Forms


Ignore:
Timestamp:
Mar 19, 2013, 8:38:28 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Možnost nastavit si formát jména výstupního souboru.
  • Opraveno: Omezení nastavení časového intervalu na povolené hodnoty.
Location:
trunk/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAccounts.pas

    r12 r14  
    3131      Selected: Boolean);
    3232  private
    33     { private declarations }
     33    DisableEditUpdate: Boolean;
    3434  public
    3535    Accounts: TListObject;
     
    6666  Selected: Boolean);
    6767begin
     68  if Assigned(ListView1.Selected) then begin
     69    DisableEditUpdate := True;
     70    LabeledEditToken.Text := TAccount(ListView1.Selected.Data).Token;
     71    LabeledEditName.Text := TAccount(ListView1.Selected.Data).Name;
     72    DisableEditUpdate := False;
     73  end;
    6874  UpdateInterface;
    6975end;
     
    7783procedure TFormAccounts.LabeledEditTokenChange(Sender: TObject);
    7884begin
    79   if Assigned(ListView1.Selected) then begin
    80     TAccount(ListView1.Selected.Data).Token := LabeledEditToken.Text;
    81     TAccount(ListView1.Selected.Data).Name := LabeledEditName.Text;
     85  if not DisableEditUpdate then begin
     86    if Assigned(ListView1.Selected) then begin
     87      TAccount(ListView1.Selected.Data).Token := LabeledEditToken.Text;
     88      TAccount(ListView1.Selected.Data).Name := LabeledEditName.Text;
     89    end;
     90    Reload;
    8291  end;
    83   Reload;
    8492end;
    8593
     
    111119  ListView1.Items.Count := Accounts.Count;
    112120  ListView1.Refresh;
     121  UpdateInterface;
    113122end;
    114123
     
    116125begin
    117126  ButtonRemove.Enabled := Assigned(ListView1.Selected);
    118   if Assigned(ListView1.Selected) then begin
    119     LabeledEditToken.Text := TAccount(ListView1.Selected.Data).Token;
    120     LabeledEditName.Text := TAccount(ListView1.Selected.Data).Name;
    121   end;
     127  LabeledEditToken.Enabled := Assigned(ListView1.Selected);
     128  LabeledEditName.Enabled := Assigned(ListView1.Selected);
    122129end;
    123130
  • trunk/Forms/UFormMain.lfm

    r12 r14  
    6666      Width = 80
    6767      CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
     68      OnAcceptDate = DateEditStartAcceptDate
    6869      OKCaption = 'OK'
    6970      CancelCaption = 'Cancel'
     
    8182      Width = 80
    8283      CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
     84      OnAcceptDate = DateEditToAcceptDate
    8385      OKCaption = 'OK'
    8486      CancelCaption = 'Cancel'
  • trunk/Forms/UFormMain.pas

    r13 r14  
    4343    procedure ButtonNewClick(Sender: TObject);
    4444    procedure ComboBoxAccountsChange(Sender: TObject);
     45    procedure DateEditStartAcceptDate(Sender: TObject; var ADate: TDateTime;
     46      var AcceptDate: Boolean);
     47    procedure DateEditToAcceptDate(Sender: TObject; var ADate: TDateTime;
     48      var AcceptDate: Boolean);
    4549    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4650    procedure FormCreate(Sender: TObject);
     
    8286    else Core.CurrentAccount := nil;
    8387  LoadInterface;
     88  Core.SelectedAccountIndex := ComboBoxAccounts.ItemIndex;
     89end;
     90
     91procedure TFormMain.DateEditStartAcceptDate(Sender: TObject;
     92  var ADate: TDateTime; var AcceptDate: Boolean);
     93begin
     94  AcceptDate := (ADate <= Now) and (ADate <= DateEditTo.Date);
     95end;
     96
     97procedure TFormMain.DateEditToAcceptDate(Sender: TObject; var ADate: TDateTime;
     98  var AcceptDate: Boolean);
     99begin
     100  AcceptDate := (ADate <= Now) and (ADate >= DateEditStart.Date);
    84101end;
    85102
     
    115132begin
    116133  Core.Accounts.LoadToStrings(ComboBoxAccounts.Items);
     134  if (Core.SelectedAccountIndex >= 0) and
     135    (Core.SelectedAccountIndex < ComboBoxAccounts.Items.Count) then
     136    ComboBoxAccounts.ItemIndex := Core.SelectedAccountIndex;
    117137  DateEditStart.Date := Core.ReportTimeFrom;
    118138  DateEditTo.Date := Core.ReportTimeTo;
    119139  SpinEditYear.Value := Core.ReportYear;
     140  SpinEditYear.MaxValue := YearOf(Now);
    120141  SpinEditId.Value := Core.ReportId;
    121142  ButtonInterval.Enabled := Assigned(Core.CurrentAccount);
    122143  ButtonMonthly.Enabled := Assigned(Core.CurrentAccount);
    123144  ButtonNew.Enabled := Assigned(Core.CurrentAccount);
     145  Core.ADownloadInterval.Enabled := Assigned(Core.CurrentAccount);
     146  Core.ADownloadMonthly.Enabled := Assigned(Core.CurrentAccount);
     147  Core.ADownloadNew.Enabled := Assigned(Core.CurrentAccount);
    124148  if ComboBoxAccounts.ItemIndex <> -1 then begin
    125149    LabelBalance.Caption := FloatToStr(TAccount(ComboBoxAccounts.Items.Objects[
  • trunk/Forms/UFormSettings.lfm

    r12 r14  
    11object FormSettings: TFormSettings
    22  Left = 420
    3   Height = 273
     3  Height = 281
    44  Top = 127
    5   Width = 550
     5  Width = 558
    66  Caption = 'Settings'
    7   ClientHeight = 273
    8   ClientWidth = 550
     7  ClientHeight = 281
     8  ClientWidth = 558
    99  OnCreate = FormCreate
    1010  Position = poScreenCenter
    1111  LCLVersion = '1.1'
    1212  object ButtonCancel: TButton
    13     Left = 376
     13    Left = 384
    1414    Height = 25
    15     Top = 242
     15    Top = 250
    1616    Width = 75
    1717    Anchors = [akRight, akBottom]
     
    2121  end
    2222  object ButtonOk: TButton
    23     Left = 464
     23    Left = 472
    2424    Height = 25
    25     Top = 242
     25    Top = 249
    2626    Width = 75
    2727    Anchors = [akRight]
     
    5252    Height = 27
    5353    Top = 88
    54     Width = 440
     54    Width = 448
    5555    Anchors = [akTop, akLeft, akRight]
    5656    EditLabel.AnchorSideLeft.Control = LabeledEditFolder
     
    6161    EditLabel.Height = 17
    6262    EditLabel.Top = 68
    63     EditLabel.Width = 440
     63    EditLabel.Width = 448
    6464    EditLabel.Caption = 'Destination folder:'
    6565    EditLabel.ParentColor = False
     
    6767  end
    6868  object Button1: TButton
    69     Left = 464
     69    Left = 472
    7070    Height = 25
    7171    Top = 88
     
    7676    TabOrder = 4
    7777  end
     78  object LabeledEditFileNameFormat: TLabeledEdit
     79    Left = 11
     80    Height = 27
     81    Top = 144
     82    Width = 448
     83    Anchors = [akTop, akLeft, akRight]
     84    EditLabel.AnchorSideLeft.Control = LabeledEditFileNameFormat
     85    EditLabel.AnchorSideRight.Control = LabeledEditFileNameFormat
     86    EditLabel.AnchorSideRight.Side = asrBottom
     87    EditLabel.AnchorSideBottom.Control = LabeledEditFileNameFormat
     88    EditLabel.Left = 11
     89    EditLabel.Height = 17
     90    EditLabel.Top = 124
     91    EditLabel.Width = 448
     92    EditLabel.Caption = 'Output file name format:'
     93    EditLabel.ParentColor = False
     94    TabOrder = 5
     95  end
     96  object Label2: TLabel
     97    Left = 11
     98    Height = 38
     99    Top = 176
     100    Width = 532
     101    Anchors = [akTop, akLeft, akRight]
     102    Caption = '%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol'
     103    ParentColor = False
     104    WordWrap = True
     105  end
    78106end
  • trunk/Forms/UFormSettings.lrt

    r12 r14  
    55TFORMSETTINGS.LABELEDEDITFOLDER.EDITLABEL.CAPTION=Destination folder:
    66TFORMSETTINGS.BUTTON1.CAPTION=Select
     7TFORMSETTINGS.LABELEDEDITFILENAMEFORMAT.EDITLABEL.CAPTION=Output file name format:
     8TFORMSETTINGS.LABEL2.CAPTION=%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol
  • trunk/Forms/UFormSettings.pas

    r12 r14  
    1919    ComboBox1: TComboBox;
    2020    Label1: TLabel;
     21    Label2: TLabel;
    2122    LabeledEditFolder: TLabeledEdit;
     23    LabeledEditFileNameFormat: TLabeledEdit;
    2224    procedure Button1Click(Sender: TObject);
    2325    procedure FormCreate(Sender: TObject);
     
    6668procedure TFormSettings.Load;
    6769begin
     70  LabeledEditFileNameFormat.Text := Core.OutputFormat;
    6871  ComboBox1.ItemIndex := Integer(Core.DataFormat);
    6972  LabeledEditFolder.Text := Core.TargetDirectory;
     
    7275procedure TFormSettings.Save;
    7376begin
     77  Core.OutputFormat := LabeledEditFileNameFormat.Text;
    7478  Core.DataFormat := TFioDataFormat(ComboBox1.ItemIndex);
    7579  Core.TargetDirectory := LabeledEditFolder.Text;
Note: See TracChangeset for help on using the changeset viewer.