Changeset 117 for branches/generator/Forms/UFormRuleItem.pas
- Timestamp:
- Nov 27, 2017, 1:09:38 PM (7 years ago)
- Location:
- branches/generator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator
- Property svn:ignore
-
old new 2 2 generator.lps 3 3 lib 4 heaptrclog.trc
-
- Property svn:ignore
-
branches/generator/Forms/UFormRuleItem.pas
r111 r117 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 URules;9 ComCtrls, URules; 10 10 11 11 type … … 16 16 ButtonCancel: TButton; 17 17 ButtonOk: TButton; 18 CheckBoxOptional: TCheckBox; 19 CheckBoxRepetitive: TCheckBox; 20 ComboBoxNonTerminal: TComboBox; 18 21 ComboBoxType: TComboBox; 19 ComboBoxNonTerminal: TComboBox;20 22 EditName: TEdit; 21 LabelTerminal: TLabel;22 23 Label2: TLabel; 23 24 LabelNonTerminal: TLabel; 25 LabelTerminal: TLabel; 26 PageControl1: TPageControl; 27 TabSheetTerminal: TTabSheet; 28 TabSheetNonTerminal: TTabSheet; 29 TabSheetSubItems: TTabSheet; 24 30 procedure ComboBoxTypeChange(Sender: TObject); 31 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 32 procedure FormCreate(Sender: TObject); 33 procedure FormDestroy(Sender: TObject); 34 procedure FormShow(Sender: TObject); 25 35 private 36 FormRuleItems: TForm; 26 37 procedure ReloadNonTerminals(Grammer: TGrammer); 27 38 public … … 35 46 FormRuleItem: TFormRuleItem; 36 47 48 37 49 implementation 50 51 uses 52 UCore, UFormRuleItems; 38 53 39 54 {$R *.lfm} … … 45 60 RuleItem.RuleItemType := TRuleItemType(ComboBoxType.ItemIndex); 46 61 UpdateInterface; 62 end; 63 64 procedure TFormRuleItem.FormClose(Sender: TObject; var CloseAction: TCloseAction 65 ); 66 begin 67 Core.PersistentForm1.Save(Self); 68 end; 69 70 procedure TFormRuleItem.FormCreate(Sender: TObject); 71 begin 72 FormRuleItems := TFormRuleItems.Create(nil); 73 FormRuleItems.ManualDock(TabSheetSubItems); 74 FormRuleItems.Align := alClient; 75 FormRuleItems.Show; 76 end; 77 78 procedure TFormRuleItem.FormDestroy(Sender: TObject); 79 begin 80 FreeAndNil(FormRuleItems); 81 end; 82 83 procedure TFormRuleItem.FormShow(Sender: TObject); 84 begin 85 Core.PersistentForm1.Load(Self); 47 86 end; 48 87 … … 59 98 procedure TFormRuleItem.UpdateInterface; 60 99 begin 100 PageControl1.PageIndex := Integer(RuleItem.RuleItemType); 61 101 EditName.Visible := RuleItem.RuleItemType = ritTerminal; 62 102 LabelTerminal.Visible := RuleItem.RuleItemType = ritTerminal; … … 72 112 ComboBoxNonTerminal.ItemIndex := ComboBoxNonTerminal.Items.IndexOfObject(RuleItem.NonTerminal); 73 113 EditName.Text := RuleItem.Terminal; 114 CheckBoxOptional.Checked := RuleItem.Optional; 115 CheckBoxRepetitive.Checked := RuleItem.Repetitive; 116 TFormRuleItems(FormRuleItems).LoadData(RuleItem.SubItems); 74 117 UpdateInterface; 75 118 end; … … 77 120 procedure TFormRuleItem.SaveData(RuleItem: TRuleItem); 78 121 begin 122 TFormRuleItems(FormRuleItems).SaveData(RuleItem.SubItems); 79 123 RuleItem.RuleItemType := TRuleItemType(ComboBoxType.ItemIndex); 80 124 if RuleItem.RuleItemType = ritTerminal then RuleItem.Terminal := EditName.Text 81 125 else if RuleItem.RuleItemType = ritNonTerminal then 82 126 RuleItem.NonTerminal := TRule(ComboBoxNonTerminal.Items.Objects[ComboBoxNonTerminal.ItemIndex]); 127 RuleItem.Optional := CheckBoxOptional.Checked; 128 RuleItem.Repetitive := CheckBoxRepetitive.Checked; 83 129 end; 84 130
Note:
See TracChangeset
for help on using the changeset viewer.