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

Legend:

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

    r119 r120  
    4545    Top = 80
    4646    Width = 640
    47     ActivePage = TabSheet1
     47    ActivePage = TabSheetUsedBy
    4848    Anchors = [akTop, akLeft, akRight, akBottom]
    49     TabIndex = 0
     49    TabIndex = 2
    5050    TabOrder = 2
    5151    object TabSheet1: TTabSheet
     
    5454    object TabSheet2: TTabSheet
    5555      Caption = 'Links'
     56    end
     57    object TabSheetUsedBy: TTabSheet
     58      Caption = 'Used by'
     59      ClientHeight = 359
     60      ClientWidth = 632
     61      object ListView1: TListView
     62        Left = 0
     63        Height = 359
     64        Top = 0
     65        Width = 632
     66        Align = alClient
     67        Columns = <       
     68          item
     69            Caption = 'Name'
     70            Width = 200
     71          end>
     72        OwnerData = True
     73        ReadOnly = True
     74        RowSelect = True
     75        TabOrder = 0
     76        ViewStyle = vsReport
     77        OnData = ListView1Data
     78      end
    5679    end
    5780  end
  • 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.