Ignore:
Timestamp:
Aug 9, 2017, 10:14:31 PM (7 years ago)
Author:
chronos
Message:
  • Added: Allow to move up/down rule items.
  • Fixed: Store rule operator to XML file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/Forms/UFormRule.pas

    r112 r113  
    1515  TFormRule = class(TForm)
    1616    AAdd: TAction;
     17    AMoveUp: TAction;
     18    AMoveDown: TAction;
    1719    AModify: TAction;
    1820    ARemove: TAction;
     
    2830    MenuItem2: TMenuItem;
    2931    MenuItem3: TMenuItem;
     32    MenuItem4: TMenuItem;
     33    MenuItem5: TMenuItem;
    3034    PopupMenu1: TPopupMenu;
    3135    ToolBar1: TToolBar;
     
    3337    ToolButton2: TToolButton;
    3438    ToolButton3: TToolButton;
     39    ToolButton4: TToolButton;
     40    ToolButton5: TToolButton;
    3541    procedure AAddExecute(Sender: TObject);
    3642    procedure AModifyExecute(Sender: TObject);
     43    procedure AMoveDownExecute(Sender: TObject);
     44    procedure AMoveUpExecute(Sender: TObject);
    3745    procedure ARemoveExecute(Sender: TObject);
    3846    procedure FormShow(Sender: TObject);
     
    123131end;
    124132
     133procedure TFormRule.AMoveDownExecute(Sender: TObject);
     134begin
     135  Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index + 1);
     136//  ShowMessage(IntToStr(ListView.ItemIndex));
     137  ListView.ItemIndex := ListView.Selected.Index + 1;
     138//  ShowMessage(IntToStr(ListView.ItemIndex));
     139  ReloadList;
     140end;
     141
     142procedure TFormRule.AMoveUpExecute(Sender: TObject);
     143begin
     144  Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index - 1);
     145  ListView.ItemIndex := ListView.Selected.Index - 1;
     146  ReloadList;
     147end;
     148
    125149procedure TFormRule.ARemoveExecute(Sender: TObject);
    126150var
     
    137161  AModify.Enabled := Assigned(ListView.Selected);
    138162  ARemove.Enabled := Assigned(ListView.Selected);
     163  AMoveUp.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index > 0);
     164  AMoveDown.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index < (ListView.Items.Count - 1));
    139165end;
    140166
Note: See TracChangeset for help on using the changeset viewer.