Changeset 296 for trunk/Forms/UFormItem.pas
- Timestamp:
- Mar 29, 2019, 12:58:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormItem.pas
r291 r296 89 89 Fields: TItemFields; 90 90 I: Integer; 91 J: Integer; 91 92 Control: TControl; 92 93 begin … … 99 100 else if DataType = dtColor then TColorBox(Control).Selected := Item.GetValueColor(Index) 100 101 else if DataType = dtBoolean then TCheckBox(Control).Checked := Item.GetValueBoolean(Index) 101 else raise Exception.Create('Unsupported type ' + IntToStr(Integer(DataType))); 102 else if DataType = dtEnumeration then begin 103 TComboBox(Control).Items.BeginUpdate; 104 try 105 TComboBox(Control).Items.Clear; 106 for J := 0 to EnumStates.Count - 1 do 107 TComboBox(Control).Items.Add(EnumStates[J]); 108 TComboBox(Control).ItemIndex := Integer(Item.GetValueEnumeration(Index)); 109 finally 110 TComboBox(Control).Items.EndUpdate; 111 end; 112 end 113 else raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[DataType]])); 102 114 end; 103 115 Fields.Free; … … 118 130 else if DataType = dtColor then Item.SetValueColor(Index, TColorBox(Control).Selected) 119 131 else if DataType = dtBoolean then Item.SetValueBoolean(Index, TCheckBox(Control).Checked) 120 else raise Exception.Create('Unsupported type ' + IntToStr(Integer(DataType))); 132 else if DataType = dtEnumeration then Item.SetValueEnumeration(Index, TUndefinedEnum(TComboBox(Control).ItemIndex)) 133 else raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[DataType]])); 121 134 end; 122 135 Fields.Free; … … 145 158 NewControl := TSpinEdit.Create(nil); 146 159 NewControl.Width := 100; 160 TSpinEdit(NewControl).MaxValue := High(Integer); 147 161 end else 148 162 if DataType = dtString then begin … … 154 168 NewControl.Width := 200; 155 169 end else 170 if DataType = dtEnumeration then begin 171 NewControl := TComboBox.Create(nil); 172 NewControl.Width := 200; 173 TComboBox(NewControl).Style := csDropDownList; 174 end else 156 175 if DataType = dtBoolean then begin 157 176 NewControl := TCheckBox.Create(nil); 158 end else raise Exception.Create('Unsupported type ' + IntToStr(Integer(DataType))); 177 end else 178 raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[DataType]])); 159 179 NewControl.Left := 150; 160 180 NewControl.Top := Y;
Note:
See TracChangeset
for help on using the changeset viewer.