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.
Location:
branches/generator/Forms
Files:
2 edited

Legend:

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

    r112 r113  
    114114      Action = ARemove
    115115    end
     116    object ToolButton4: TToolButton
     117      Left = 70
     118      Top = 2
     119      Action = AMoveUp
     120    end
     121    object ToolButton5: TToolButton
     122      Left = 93
     123      Top = 2
     124      Action = AMoveDown
     125    end
    116126  end
    117127  object ActionList1: TActionList
     
    134144      OnExecute = ARemoveExecute
    135145    end
     146    object AMoveUp: TAction
     147      Caption = 'Move up'
     148      ImageIndex = 7
     149      OnExecute = AMoveUpExecute
     150    end
     151    object AMoveDown: TAction
     152      Caption = 'Move down'
     153      ImageIndex = 6
     154      OnExecute = AMoveDownExecute
     155    end
    136156  end
    137157  object PopupMenu1: TPopupMenu
    138158    Images = Core.ImageList1
    139159    left = 118
    140     top = 185
     160    top = 187
    141161    object MenuItem1: TMenuItem
    142162      Action = AAdd
     
    148168      Action = ARemove
    149169    end
     170    object MenuItem4: TMenuItem
     171      Action = AMoveUp
     172    end
     173    object MenuItem5: TMenuItem
     174      Action = AMoveDown
     175    end
    150176  end
    151177end
  • 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.