| 1 | unit UDataTypes;
|
|---|
| 2 |
|
|---|
| 3 | {$mode delphi}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, Controls, Spin, StdCtrls, ExtCtrls, MaskEdit, EditBtn,
|
|---|
| 9 | UPDClient;
|
|---|
| 10 |
|
|---|
| 11 | type
|
|---|
| 12 |
|
|---|
| 13 | { TDataType }
|
|---|
| 14 |
|
|---|
| 15 | TDataType = class
|
|---|
| 16 | Name: string;
|
|---|
| 17 | CustomType: Integer;
|
|---|
| 18 | Control: TWinControl;
|
|---|
| 19 | function CreateControl(Owner: TComponent): TWinControl; virtual;
|
|---|
| 20 | procedure SetupControl(Control: TWinControl); virtual;
|
|---|
| 21 | function GetControlValue(Control: TWinControl): string; virtual;
|
|---|
| 22 | procedure Load(CellValue: string); virtual;
|
|---|
| 23 | procedure LoadDef(ACustomType: Integer); virtual;
|
|---|
| 24 | procedure SetDefault; virtual;
|
|---|
| 25 | function GetStringValue: string; virtual;
|
|---|
| 26 | constructor Create; virtual;
|
|---|
| 27 | end;
|
|---|
| 28 |
|
|---|
| 29 | { TDataTypeNumber }
|
|---|
| 30 |
|
|---|
| 31 | TDataTypeNumber = class(TDataType)
|
|---|
| 32 | Value: Integer;
|
|---|
| 33 | Default: Integer;
|
|---|
| 34 | Min: Integer;
|
|---|
| 35 | Max: Integer;
|
|---|
| 36 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 37 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 38 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 39 | procedure Load(CellValue: string); override;
|
|---|
| 40 | procedure LoadDef(CustomType: Integer); override;
|
|---|
| 41 | constructor Create; override;
|
|---|
| 42 | end;
|
|---|
| 43 |
|
|---|
| 44 | { TDataTypeString }
|
|---|
| 45 |
|
|---|
| 46 | TDataTypeString = class(TDataType)
|
|---|
| 47 | Value: string;
|
|---|
| 48 | Default: string;
|
|---|
| 49 | MaxLength: Integer;
|
|---|
| 50 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 51 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 52 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 53 | procedure Load(CellValue: string); override;
|
|---|
| 54 | constructor Create; override;
|
|---|
| 55 | end;
|
|---|
| 56 |
|
|---|
| 57 | { TDataTypePassword }
|
|---|
| 58 |
|
|---|
| 59 | TDataTypePassword = class(TDataType)
|
|---|
| 60 | Value: string;
|
|---|
| 61 | Default: string;
|
|---|
| 62 | MaxLength: Integer;
|
|---|
| 63 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 64 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 65 | procedure Load(CellValue: string); override;
|
|---|
| 66 | constructor Create; override;
|
|---|
| 67 | end;
|
|---|
| 68 |
|
|---|
| 69 | { TDataTypeBoolean }
|
|---|
| 70 |
|
|---|
| 71 | TDataTypeBoolean = class(TDataType)
|
|---|
| 72 | Value: Boolean;
|
|---|
| 73 | Default: Boolean;
|
|---|
| 74 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 75 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 76 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 77 | procedure Load(CellValue: string); override;
|
|---|
| 78 | constructor Create; override;
|
|---|
| 79 | end;
|
|---|
| 80 |
|
|---|
| 81 | { TDataTypeRelationOne }
|
|---|
| 82 |
|
|---|
| 83 | TDataTypeRelationOne = class(TDataType)
|
|---|
| 84 | private
|
|---|
| 85 | procedure ButtonClickExecute(Sender: TObject);
|
|---|
| 86 | public
|
|---|
| 87 | ObjectId: Integer;
|
|---|
| 88 | SelectedItemName: string;
|
|---|
| 89 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 90 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 91 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 92 | procedure Load(CellValue: string); override;
|
|---|
| 93 | procedure LoadDef(ACustomType: Integer); override;
|
|---|
| 94 | constructor Create; override;
|
|---|
| 95 | end;
|
|---|
| 96 |
|
|---|
| 97 | { TDataTypeRelationMany }
|
|---|
| 98 |
|
|---|
| 99 | TDataTypeRelationMany = class(TDataType)
|
|---|
| 100 | ObjectId: Integer;
|
|---|
| 101 | PropertyID: Integer;
|
|---|
| 102 | PropertyName: string;
|
|---|
| 103 | SelectedItemName: string;
|
|---|
| 104 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 105 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 106 | procedure Load(CellValue: string); override;
|
|---|
| 107 | procedure LoadDef(ACustomType: Integer); override;
|
|---|
| 108 | constructor Create; override;
|
|---|
| 109 | end;
|
|---|
| 110 |
|
|---|
| 111 | { TDataTypeDateTime }
|
|---|
| 112 |
|
|---|
| 113 | TDataTypeDate = class(TDataType)
|
|---|
| 114 | Value: TDateTime;
|
|---|
| 115 | Default: TDateTime;
|
|---|
| 116 | Min: TDateTime;
|
|---|
| 117 | Max: TDateTime;
|
|---|
| 118 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 119 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 120 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 121 | procedure Load(CellValue: string); override;
|
|---|
| 122 | constructor Create; override;
|
|---|
| 123 | end;
|
|---|
| 124 |
|
|---|
| 125 | TDataTypeDateTime = class(TDataType)
|
|---|
| 126 | Value: TDateTime;
|
|---|
| 127 | Default: TDateTime;
|
|---|
| 128 | Min: TDateTime;
|
|---|
| 129 | Max: TDateTime;
|
|---|
| 130 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 131 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 132 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 133 | procedure Load(CellValue: string); override;
|
|---|
| 134 | constructor Create; override;
|
|---|
| 135 | end;
|
|---|
| 136 |
|
|---|
| 137 | { TDataTypeFloat }
|
|---|
| 138 |
|
|---|
| 139 | TDataTypeFloat = class(TDataType)
|
|---|
| 140 | Value: Double;
|
|---|
| 141 | Default: Double;
|
|---|
| 142 | Min: Double;
|
|---|
| 143 | Max: Double;
|
|---|
| 144 | function CreateControl(Owner: TComponent): TWinControl; override;
|
|---|
| 145 | function GetControlValue(Control: TWinControl): string; override;
|
|---|
| 146 | procedure SetupControl(Control: TWinControl); override;
|
|---|
| 147 | procedure Load(CellValue: string); override;
|
|---|
| 148 | constructor Create; override;
|
|---|
| 149 | end;
|
|---|
| 150 |
|
|---|
| 151 | function GetDataType(ACustomType: Integer): TDataType;
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 | implementation
|
|---|
| 155 |
|
|---|
| 156 | uses
|
|---|
| 157 | USqlDatabase, UFormItemSelect, UFormMain, UCore, USystem;
|
|---|
| 158 |
|
|---|
| 159 | function GetDataType(ACustomType: Integer): TDataType;
|
|---|
| 160 | var
|
|---|
| 161 | Proxy: TListProxy;
|
|---|
| 162 | BaseType: Integer;
|
|---|
| 163 | begin
|
|---|
| 164 | try
|
|---|
| 165 | Proxy := TListProxy.Create;
|
|---|
| 166 | Proxy.Client := Core.System.Client;
|
|---|
| 167 | Proxy.ObjectName := CustomTypeTableName;
|
|---|
| 168 | Proxy.Condition := 'Id=' + IntToStr(ACustomType);
|
|---|
| 169 | Proxy.Load;
|
|---|
| 170 | BaseType := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Type']);
|
|---|
| 171 | finally
|
|---|
| 172 | Proxy.Free;
|
|---|
| 173 | end;
|
|---|
| 174 |
|
|---|
| 175 | if BaseType = Integer(vtInteger) then begin
|
|---|
| 176 | Result := TDataTypeNumber.Create;
|
|---|
| 177 | end else
|
|---|
| 178 | if BaseType = Integer(vtDate) then begin
|
|---|
| 179 | Result := TDataTypeDate.Create;
|
|---|
| 180 | end else
|
|---|
| 181 | if BaseType = Integer(vtDateTime) then begin
|
|---|
| 182 | Result := TDataTypeDateTime.Create;
|
|---|
| 183 | end else
|
|---|
| 184 | if BaseType = Integer(vtFloat) then begin
|
|---|
| 185 | Result := TDataTypeFloat.Create;
|
|---|
| 186 | end else
|
|---|
| 187 | if BaseType = Integer(vtString) then begin
|
|---|
| 188 | Result := TDataTypeString.Create;
|
|---|
| 189 | end else
|
|---|
| 190 | if BaseType = Integer(vtPassword) then begin
|
|---|
| 191 | Result := TDataTypePassword.Create;
|
|---|
| 192 | end else
|
|---|
| 193 | if BaseType = Integer(vtBoolean) then begin
|
|---|
| 194 | Result := TDataTypeBoolean.Create;
|
|---|
| 195 | end else
|
|---|
| 196 | if BaseType = Integer(vtRelationOne) then begin
|
|---|
| 197 | Result := TDataTypeRelationOne.Create;
|
|---|
| 198 | end else
|
|---|
| 199 | if BaseType = Integer(vtRelationMany) then begin
|
|---|
| 200 | Result := TDataTypeRelationMany.Create;
|
|---|
| 201 | end else begin
|
|---|
| 202 | Result := TDataTypeString.Create;
|
|---|
| 203 | end;
|
|---|
| 204 | Result.CustomType := ACustomType;
|
|---|
| 205 | end;
|
|---|
| 206 |
|
|---|
| 207 | { TDataTypeDateTime }
|
|---|
| 208 |
|
|---|
| 209 | function TDataTypeDateTime.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 210 | begin
|
|---|
| 211 | Result := TDateEdit.Create(Owner);
|
|---|
| 212 | end;
|
|---|
| 213 |
|
|---|
| 214 | function TDataTypeDateTime.GetControlValue(Control: TWinControl): string;
|
|---|
| 215 | begin
|
|---|
| 216 | Result := DateTimeToSQL(TDateEdit(Control).Date);
|
|---|
| 217 | end;
|
|---|
| 218 |
|
|---|
| 219 | procedure TDataTypeDateTime.SetupControl(Control: TWinControl);
|
|---|
| 220 | begin
|
|---|
| 221 | TDateEdit(Control).Date := Value;
|
|---|
| 222 | end;
|
|---|
| 223 |
|
|---|
| 224 | procedure TDataTypeDateTime.Load(CellValue: string);
|
|---|
| 225 | begin
|
|---|
| 226 | Value := SQLToDateTime(CellValue);
|
|---|
| 227 | end;
|
|---|
| 228 |
|
|---|
| 229 | constructor TDataTypeDateTime.Create;
|
|---|
| 230 | begin
|
|---|
| 231 | inherited Create;
|
|---|
| 232 | Name := 'DateType';
|
|---|
| 233 | end;
|
|---|
| 234 |
|
|---|
| 235 | { TDataTypeRelationMany }
|
|---|
| 236 |
|
|---|
| 237 | function TDataTypeRelationMany.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 238 | begin
|
|---|
| 239 | Result := inherited CreateControl(Owner);
|
|---|
| 240 | end;
|
|---|
| 241 |
|
|---|
| 242 | procedure TDataTypeRelationMany.SetupControl(Control: TWinControl);
|
|---|
| 243 | begin
|
|---|
| 244 | inherited SetupControl(Control);
|
|---|
| 245 | end;
|
|---|
| 246 |
|
|---|
| 247 | procedure TDataTypeRelationMany.Load(CellValue: string);
|
|---|
| 248 | begin
|
|---|
| 249 | inherited Load(CellValue);
|
|---|
| 250 | end;
|
|---|
| 251 |
|
|---|
| 252 | procedure TDataTypeRelationMany.LoadDef(ACustomType: Integer);
|
|---|
| 253 | var
|
|---|
| 254 | Proxy: TListProxy;
|
|---|
| 255 | BaseType: Integer;
|
|---|
| 256 | begin
|
|---|
| 257 | try
|
|---|
| 258 | Proxy := TListProxy.Create;
|
|---|
| 259 | Proxy.Client := Core.System.Client;
|
|---|
| 260 | Proxy.ObjectName := TypeRelationMany;
|
|---|
| 261 | Proxy.Condition := 'CustomType=' + IntToStr(ACustomType);
|
|---|
| 262 | Proxy.Load;
|
|---|
| 263 | PropertyID := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['ObjectProperty']);
|
|---|
| 264 | finally
|
|---|
| 265 | Proxy.Free;
|
|---|
| 266 | end;
|
|---|
| 267 | try
|
|---|
| 268 | Proxy := TListProxy.Create;
|
|---|
| 269 | Proxy.Client := Core.System.Client;
|
|---|
| 270 | Proxy.ObjectName := PropertyTable;
|
|---|
| 271 | Proxy.Condition := 'Id=' + IntToStr(PropertyID);
|
|---|
| 272 | Proxy.Load;
|
|---|
| 273 | ObjectId := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Object']);
|
|---|
| 274 | PropertyName := TObjectProxy(Proxy.Objects[0]).Properties.Values['ColumnName'];
|
|---|
| 275 | finally
|
|---|
| 276 | Proxy.Free;
|
|---|
| 277 | end;
|
|---|
| 278 | end;
|
|---|
| 279 |
|
|---|
| 280 | constructor TDataTypeRelationMany.Create;
|
|---|
| 281 | begin
|
|---|
| 282 | inherited Create;
|
|---|
| 283 | Name := 'RelationMany';
|
|---|
| 284 | end;
|
|---|
| 285 |
|
|---|
| 286 | { TDataTypeRelationOne }
|
|---|
| 287 |
|
|---|
| 288 | procedure TDataTypeRelationOne.ButtonClickExecute(Sender: TObject);
|
|---|
| 289 | var
|
|---|
| 290 | NewSelectForm: TItemSelectForm;
|
|---|
| 291 | begin
|
|---|
| 292 | try
|
|---|
| 293 | NewSelectForm := TItemSelectForm.Create(MainForm);
|
|---|
| 294 | NewSelectForm.ObjectId := ObjectId;
|
|---|
| 295 | NewSelectForm.ShowModal;
|
|---|
| 296 | TEditButton(Control).Text := IntToStr(NewSelectForm.SelectedId)
|
|---|
| 297 | finally
|
|---|
| 298 | ItemSelectForm.Free;
|
|---|
| 299 | end;
|
|---|
| 300 | end;
|
|---|
| 301 |
|
|---|
| 302 | function TDataTypeRelationOne.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 303 | begin
|
|---|
| 304 | Result := TEditButton.Create(Owner);
|
|---|
| 305 | TEditButton(Result).Enabled := False;
|
|---|
| 306 | TEditButton(Result).Button.Enabled := True;
|
|---|
| 307 | TEditButton(Result).Button.OnClick := ButtonClickExecute;
|
|---|
| 308 | Control := Result;
|
|---|
| 309 | end;
|
|---|
| 310 |
|
|---|
| 311 | procedure TDataTypeRelationOne.SetupControl(Control: TWinControl);
|
|---|
| 312 | begin
|
|---|
| 313 | TEditButton(Control).Text := SelectedItemName;
|
|---|
| 314 | end;
|
|---|
| 315 |
|
|---|
| 316 | function TDataTypeRelationOne.GetControlValue(Control: TWinControl): string;
|
|---|
| 317 | begin
|
|---|
| 318 | Result := TEditButton(Control).Text;
|
|---|
| 319 | end;
|
|---|
| 320 |
|
|---|
| 321 | procedure TDataTypeRelationOne.Load(CellValue: string);
|
|---|
| 322 | begin
|
|---|
| 323 | SelectedItemName := CellValue;
|
|---|
| 324 | end;
|
|---|
| 325 |
|
|---|
| 326 | procedure TDataTypeRelationOne.LoadDef(ACustomType: Integer);
|
|---|
| 327 | var
|
|---|
| 328 | Proxy: TListProxy;
|
|---|
| 329 | begin
|
|---|
| 330 | try
|
|---|
| 331 | Proxy := TListProxy.Create;
|
|---|
| 332 | Proxy.Client := Core.System.Client;
|
|---|
| 333 | Proxy.ObjectName := TypeRelationOne;
|
|---|
| 334 | Proxy.Condition := 'CustomType=' + IntToStr(ACustomType);
|
|---|
| 335 | Proxy.Load;
|
|---|
| 336 | ObjectId := StrToInt(TObjectProxy(Proxy.Objects[0]).Properties.Values['Object']);
|
|---|
| 337 | finally
|
|---|
| 338 | Proxy.Free;
|
|---|
| 339 | end;
|
|---|
| 340 | end;
|
|---|
| 341 |
|
|---|
| 342 | constructor TDataTypeRelationOne.Create;
|
|---|
| 343 | begin
|
|---|
| 344 | inherited Create;
|
|---|
| 345 | Name := 'RelationOne';
|
|---|
| 346 | end;
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 | { TDataTypePassword }
|
|---|
| 350 |
|
|---|
| 351 | function TDataTypePassword.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 352 | begin
|
|---|
| 353 | Result := TMaskEdit.Create(Owner);
|
|---|
| 354 | end;
|
|---|
| 355 |
|
|---|
| 356 | procedure TDataTypePassword.SetupControl(Control: TWinControl);
|
|---|
| 357 | begin
|
|---|
| 358 | TMaskEdit(Control).Text := Value;
|
|---|
| 359 | end;
|
|---|
| 360 |
|
|---|
| 361 | procedure TDataTypePassword.Load(CellValue: string);
|
|---|
| 362 | begin
|
|---|
| 363 | Value := CellValue;
|
|---|
| 364 | end;
|
|---|
| 365 |
|
|---|
| 366 | constructor TDataTypePassword.Create;
|
|---|
| 367 | begin
|
|---|
| 368 | inherited Create;
|
|---|
| 369 | Name := 'Password';
|
|---|
| 370 | end;
|
|---|
| 371 |
|
|---|
| 372 | { TDataTypeFloat }
|
|---|
| 373 |
|
|---|
| 374 | function TDataTypeFloat.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 375 | begin
|
|---|
| 376 | Result := TFloatSpinEdit.Create(Owner);
|
|---|
| 377 | end;
|
|---|
| 378 |
|
|---|
| 379 | function TDataTypeFloat.GetControlValue(Control: TWinControl): string;
|
|---|
| 380 | begin
|
|---|
| 381 | Result := MySQLFloatToStr(TFloatSpinEdit(Control).Value);
|
|---|
| 382 | end;
|
|---|
| 383 |
|
|---|
| 384 | procedure TDataTypeFloat.SetupControl(Control: TWinControl);
|
|---|
| 385 | begin
|
|---|
| 386 | TFloatSpinEdit(Control).Value := Value;
|
|---|
| 387 | end;
|
|---|
| 388 |
|
|---|
| 389 | procedure TDataTypeFloat.Load(CellValue: string);
|
|---|
| 390 | begin
|
|---|
| 391 | Value := MySQLStrToFloat(CellValue);
|
|---|
| 392 | end;
|
|---|
| 393 |
|
|---|
| 394 | constructor TDataTypeFloat.Create;
|
|---|
| 395 | begin
|
|---|
| 396 | inherited Create;
|
|---|
| 397 | Name := 'Float';
|
|---|
| 398 | end;
|
|---|
| 399 |
|
|---|
| 400 | { TDataTypeDateTime }
|
|---|
| 401 |
|
|---|
| 402 | function TDataTypeDate.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 403 | begin
|
|---|
| 404 | Result := TDateEdit.Create(Owner);
|
|---|
| 405 | end;
|
|---|
| 406 |
|
|---|
| 407 | function TDataTypeDate.GetControlValue(Control: TWinControl): string;
|
|---|
| 408 | begin
|
|---|
| 409 | Result := DateTimeToSQL(TDateEdit(Control).Date);
|
|---|
| 410 | end;
|
|---|
| 411 |
|
|---|
| 412 | procedure TDataTypeDate.SetupControl(Control: TWinControl);
|
|---|
| 413 | begin
|
|---|
| 414 | TDateEdit(Control).Date := Value;
|
|---|
| 415 | end;
|
|---|
| 416 |
|
|---|
| 417 | procedure TDataTypeDate.Load(CellValue: string);
|
|---|
| 418 | begin
|
|---|
| 419 | Value := SQLToDateTime(CellValue);
|
|---|
| 420 | end;
|
|---|
| 421 |
|
|---|
| 422 | constructor TDataTypeDate.Create;
|
|---|
| 423 | begin
|
|---|
| 424 | inherited Create;
|
|---|
| 425 | Name := 'Date';
|
|---|
| 426 | end;
|
|---|
| 427 |
|
|---|
| 428 | { TDataTypeBoolean }
|
|---|
| 429 |
|
|---|
| 430 | function TDataTypeBoolean.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 431 | begin
|
|---|
| 432 | Result := TCheckBox.Create(Owner);
|
|---|
| 433 | end;
|
|---|
| 434 |
|
|---|
| 435 | function TDataTypeBoolean.GetControlValue(Control: TWinControl): string;
|
|---|
| 436 | begin
|
|---|
| 437 | Result := IntToStr(Integer(TCheckBox(Control).Checked));
|
|---|
| 438 | end;
|
|---|
| 439 |
|
|---|
| 440 | procedure TDataTypeBoolean.SetupControl(Control: TWinControl);
|
|---|
| 441 | begin
|
|---|
| 442 | TCheckBox(Control).Checked := Value;
|
|---|
| 443 | end;
|
|---|
| 444 |
|
|---|
| 445 | procedure TDataTypeBoolean.Load(CellValue: string);
|
|---|
| 446 | begin
|
|---|
| 447 | Value := Boolean(StrToInt(CellValue));
|
|---|
| 448 | end;
|
|---|
| 449 |
|
|---|
| 450 | constructor TDataTypeBoolean.Create;
|
|---|
| 451 | begin
|
|---|
| 452 | inherited Create;
|
|---|
| 453 | Name := 'Boolean';
|
|---|
| 454 | end;
|
|---|
| 455 |
|
|---|
| 456 | { TDataTypeNumber }
|
|---|
| 457 |
|
|---|
| 458 | function TDataTypeNumber.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 459 | begin
|
|---|
| 460 | Result := TSpinEdit.Create(Owner);
|
|---|
| 461 | end;
|
|---|
| 462 |
|
|---|
| 463 | procedure TDataTypeNumber.SetupControl(Control: TWinControl);
|
|---|
| 464 | begin
|
|---|
| 465 | inherited SetupControl(Control);
|
|---|
| 466 | TSpinEdit(Control).Value := Value;
|
|---|
| 467 | end;
|
|---|
| 468 |
|
|---|
| 469 | function TDataTypeNumber.GetControlValue(Control: TWinControl): string;
|
|---|
| 470 | begin
|
|---|
| 471 | Result := IntToStr(TSpinEdit(Control).Value);
|
|---|
| 472 | end;
|
|---|
| 473 |
|
|---|
| 474 | procedure TDataTypeNumber.Load(CellValue: string);
|
|---|
| 475 | begin
|
|---|
| 476 | inherited Load(CellValue);
|
|---|
| 477 | Value := StrToInt(CellValue);
|
|---|
| 478 | end;
|
|---|
| 479 |
|
|---|
| 480 | procedure TDataTypeNumber.LoadDef(CustomType: Integer);
|
|---|
| 481 | begin
|
|---|
| 482 |
|
|---|
| 483 | end;
|
|---|
| 484 |
|
|---|
| 485 | constructor TDataTypeNumber.Create;
|
|---|
| 486 | begin
|
|---|
| 487 | inherited Create;
|
|---|
| 488 | Name := 'Number';
|
|---|
| 489 | end;
|
|---|
| 490 |
|
|---|
| 491 | { TDataTypeString }
|
|---|
| 492 |
|
|---|
| 493 | function TDataTypeString.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 494 | begin
|
|---|
| 495 | Result := TEdit.Create(Owner);
|
|---|
| 496 | end;
|
|---|
| 497 |
|
|---|
| 498 | procedure TDataTypeString.SetupControl(Control: TWinControl);
|
|---|
| 499 | begin
|
|---|
| 500 | TEdit(Control).Text := Value;
|
|---|
| 501 | end;
|
|---|
| 502 |
|
|---|
| 503 | function TDataTypeString.GetControlValue(Control: TWinControl): string;
|
|---|
| 504 | begin
|
|---|
| 505 | Result := TEdit(Control).Text;
|
|---|
| 506 | end;
|
|---|
| 507 |
|
|---|
| 508 | procedure TDataTypeString.Load(CellValue: string);
|
|---|
| 509 | begin
|
|---|
| 510 | Value := CellValue;
|
|---|
| 511 | end;
|
|---|
| 512 |
|
|---|
| 513 | constructor TDataTypeString.Create;
|
|---|
| 514 | begin
|
|---|
| 515 | inherited Create;
|
|---|
| 516 | Name := 'String';
|
|---|
| 517 | end;
|
|---|
| 518 |
|
|---|
| 519 | { TDataType }
|
|---|
| 520 |
|
|---|
| 521 | function TDataType.CreateControl(Owner: TComponent): TWinControl;
|
|---|
| 522 | begin
|
|---|
| 523 |
|
|---|
| 524 | end;
|
|---|
| 525 |
|
|---|
| 526 | procedure TDataType.SetupControl(Control: TWinControl);
|
|---|
| 527 | begin
|
|---|
| 528 |
|
|---|
| 529 | end;
|
|---|
| 530 |
|
|---|
| 531 | function TDataType.GetControlValue(Control: TWinControl): string;
|
|---|
| 532 | begin
|
|---|
| 533 |
|
|---|
| 534 | end;
|
|---|
| 535 |
|
|---|
| 536 | procedure TDataType.Load(CellValue: string);
|
|---|
| 537 | begin
|
|---|
| 538 |
|
|---|
| 539 | end;
|
|---|
| 540 |
|
|---|
| 541 | procedure TDataType.LoadDef(ACustomType: Integer);
|
|---|
| 542 | begin
|
|---|
| 543 |
|
|---|
| 544 | end;
|
|---|
| 545 |
|
|---|
| 546 | procedure TDataType.SetDefault;
|
|---|
| 547 | begin
|
|---|
| 548 |
|
|---|
| 549 | end;
|
|---|
| 550 |
|
|---|
| 551 | function TDataType.GetStringValue: string;
|
|---|
| 552 | begin
|
|---|
| 553 | Result := '';
|
|---|
| 554 | end;
|
|---|
| 555 |
|
|---|
| 556 | constructor TDataType.Create;
|
|---|
| 557 | begin
|
|---|
| 558 | inherited;
|
|---|
| 559 | end;
|
|---|
| 560 |
|
|---|
| 561 | end.
|
|---|
| 562 |
|
|---|