Ignore:
Timestamp:
Nov 29, 2017, 1:21:22 PM (7 years ago)
Author:
chronos
Message:
  • Added: Show "Used by" rules in rule edit window.
File:
1 edited

Legend:

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

    r119 r120  
    1919    EditName: TEdit;
    2020    Label1: TLabel;
     21    ListView1: TListView;
    2122    PageControl1: TPageControl;
    2223    TabSheet1: TTabSheet;
    2324    TabSheet2: TTabSheet;
     25    TabSheetUsedBy: TTabSheet;
    2426    procedure FormCreate(Sender: TObject);
    2527    procedure FormDestroy(Sender: TObject);
    2628    procedure FormShow(Sender: TObject);
     29    procedure ListView1Data(Sender: TObject; Item: TListItem);
    2730  private
    2831    FormRuleItems: TFormRuleItems;
     32    UsedByRules: TStringList;
     33    procedure ReloadUsedByRules;
    2934  public
    3035    Rule: TRule;
     
    3944implementation
    4045
     46uses
     47  UCore;
     48
    4149{$R *.lfm}
    4250
     
    4654begin
    4755  EditName.SetFocus;
     56  PageControl1.TabIndex := 0;  // Select first tab by default
     57end;
     58
     59procedure TFormRule.ListView1Data(Sender: TObject; Item: TListItem);
     60begin
     61  if Item.Index < UsedByRules.Count then
     62  begin
     63    Item.Caption := UsedByRules[Item.Index];
     64    Item.Data := UsedByRules.Objects[Item.Index];
     65  end;
     66end;
     67
     68procedure TFormRule.ReloadUsedByRules;
     69begin
     70  ListView1.Items.Count := UsedByRules.Count;
     71  ListView1.Refresh;
    4872end;
    4973
     
    5478  FormRuleItems.Align := alClient;
    5579  FormRuleItems.Show;
     80  UsedByRules := TStringList.Create;
    5681end;
    5782
    5883procedure TFormRule.FormDestroy(Sender: TObject);
    5984begin
     85  FreeAndNil(UsedByRules);
    6086  FreeAndNil(FormRuleItems);
    6187end;
     
    6490begin
    6591  Self.Rule := Rule;
     92  Rule.Grammer.GetUsedByRule(Rule, UsedByRules);
     93  ReloadUsedByRules;
    6694  EditName.Text := Rule.Name;
    6795  CheckBoxCreateNode.Checked := Rule.CreateSourceNode;
Note: See TracChangeset for help on using the changeset viewer.