Changeset 16 for trunk/Application


Ignore:
Timestamp:
Jun 13, 2011, 12:43:29 PM (13 years ago)
Author:
george
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UDataTypes.pas

    r15 r16  
    2020    procedure LoadDef(CustomType: Integer); virtual;
    2121    procedure SetDefault; virtual;
     22    function GetStringValue: string; virtual;
    2223  end;
    2324
     
    7475  TDataTypeRelationOne = class(TDataType)
    7576    ObjectId: Integer;
     77    SelectedItemName: string;
     78    function CreateControl(Owner: TComponent): TWinControl; override;
     79    procedure SetupControl(Control: TWinControl); override;
     80    procedure Load(CellValue: string); override;
     81  end;
     82
     83  { TDataTypeRelationMany }
     84
     85  TDataTypeRelationMany = class(TDataType)
     86    ObjectId: Integer;
     87    PropertyID: Integer;
     88    SelectedItemName: string;
    7689    function CreateControl(Owner: TComponent): TWinControl; override;
    7790    procedure SetupControl(Control: TWinControl); override;
     
    143156  if BaseType = Integer(vtBoolean) then begin
    144157    Result := TDataTypeBoolean.Create;
     158  end else
     159  if BaseType = Integer(vtRelationOne) then begin
     160    Result := TDataTypeRelationOne.Create;
     161  end else
     162  if BaseType = Integer(vtRelationMany) then begin
     163    Result := TDataTypeRelationMany.Create;
    145164  end else begin
    146165    Result := TDataTypeString.Create;
     
    149168end;
    150169
     170{ TDataTypeRelationMany }
     171
     172function TDataTypeRelationMany.CreateControl(Owner: TComponent): TWinControl;
     173begin
     174  Result:=inherited CreateControl(Owner);
     175end;
     176
     177procedure TDataTypeRelationMany.SetupControl(Control: TWinControl);
     178begin
     179  inherited SetupControl(Control);
     180end;
     181
     182procedure TDataTypeRelationMany.Load(CellValue: string);
     183begin
     184  inherited Load(CellValue);
     185end;
     186
    151187{ TDataTypeRelationOne }
    152188
    153189function TDataTypeRelationOne.CreateControl(Owner: TComponent): TWinControl;
    154190begin
    155   Result:=inherited CreateControl(Owner);
     191  Result := TEdit.Create(Owner);
     192  TEdit(Result).Enabled := False;
    156193end;
    157194
    158195procedure TDataTypeRelationOne.SetupControl(Control: TWinControl);
    159196begin
    160   inherited SetupControl(Control);
     197  TEdit(Control).Text := SelectedItemName;
    161198end;
    162199
    163200procedure TDataTypeRelationOne.Load(CellValue: string);
    164201begin
    165   inherited Load(CellValue);
     202  SelectedItemName := CellValue;
    166203end;
    167204
     
    333370end;
    334371
     372function TDataType.GetStringValue: string;
     373begin
     374  Result := '';
     375end;
     376
    335377end.
    336378
Note: See TracChangeset for help on using the changeset viewer.