Changeset 298 for trunk/Forms/UFormItem.pas
- Timestamp:
- Jul 10, 2019, 5:35:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormItem.pas
r296 r298 91 91 J: Integer; 92 92 Control: TControl; 93 ReferenceList: TItemList; 94 ReferenceItem: TItem; 93 95 begin 94 96 Fields := Item.GetFields; … … 111 113 end; 112 114 end 115 else if DataType = dtReference then begin 116 TComboBox(Control).Items.BeginUpdate; 117 try 118 TComboBox(Control).Items.Clear; 119 ReferenceList := Item.GetReferenceList(Index); 120 if Assigned(ReferenceList) then 121 for J := 0 to ReferenceList.Count - 1 do 122 TComboBox(Control).Items.AddObject(TItem(ReferenceList[J]).Name, ReferenceList[J]); 123 ReferenceItem := TItem(Item.GetValueReference(Index)); 124 TComboBox(Control).ItemIndex := TComboBox(Control).Items.IndexOfObject(ReferenceItem); 125 finally 126 TComboBox(Control).Items.EndUpdate; 127 end; 128 end 113 129 else raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[DataType]])); 114 130 end; … … 131 147 else if DataType = dtBoolean then Item.SetValueBoolean(Index, TCheckBox(Control).Checked) 132 148 else if DataType = dtEnumeration then Item.SetValueEnumeration(Index, TUndefinedEnum(TComboBox(Control).ItemIndex)) 149 else if DataType = dtReference then begin 150 if TComboBox(Control).ItemIndex <> -1 then 151 Item.SetValueReference(Index, TItem(TComboBox(Control).Items.Objects[TComboBox(Control).ItemIndex])) 152 else Item.SetValueReference(Index, nil); 153 end 133 154 else raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[DataType]])); 134 155 end; … … 173 194 TComboBox(NewControl).Style := csDropDownList; 174 195 end else 196 if DataType = dtReference then begin 197 NewControl := TComboBox.Create(nil); 198 NewControl.Width := 200; 199 TComboBox(NewControl).Style := csDropDownList; 200 end else 175 201 if DataType = dtBoolean then begin 176 202 NewControl := TCheckBox.Create(nil);
Note:
See TracChangeset
for help on using the changeset viewer.