Changeset 21 for trunk/Application
- Timestamp:
- Jun 16, 2011, 10:32:01 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UDataTypes.pas
r20 r21 18 18 function GetControlValue(Control: TWinControl): string; virtual; 19 19 procedure Load(CellValue: string); virtual; 20 procedure LoadDef( CustomType: Integer); virtual;20 procedure LoadDef(ACustomType: Integer); virtual; 21 21 procedure SetDefault; virtual; 22 22 function GetStringValue: string; virtual; … … 74 74 75 75 TDataTypeRelationOne = class(TDataType) 76 private 77 procedure ButtonClickExecute(Sender: TObject); 78 public 76 79 ObjectId: Integer; 77 80 SelectedItemName: string; … … 79 82 procedure SetupControl(Control: TWinControl); override; 80 83 procedure Load(CellValue: string); override; 84 procedure LoadDef(ACustomType: Integer); override; 81 85 end; 82 86 … … 137 141 138 142 uses 139 USqlDatabase, USystem, UCore ;143 USqlDatabase, USystem, UCore, UItemSelect; 140 144 141 145 function GetDataType(ACustomType: Integer): TDataType; … … 247 251 { TDataTypeRelationOne } 248 252 253 procedure TDataTypeRelationOne.ButtonClickExecute(Sender: TObject); 254 begin 255 ItemSelectForm.ObjectId := ObjectId; 256 ItemSelectForm.ShowModal; 257 end; 258 249 259 function TDataTypeRelationOne.CreateControl(Owner: TComponent): TWinControl; 250 260 begin 251 Result := TEdit.Create(Owner); 252 TEdit(Result).Enabled := False; 261 Result := TEditButton.Create(Owner); 262 TEditButton(Result).Enabled := False; 263 TEditButton(Result).Button.Enabled := True; 264 TEditButton(Result).Button.OnClick := ButtonClickExecute; 253 265 end; 254 266 255 267 procedure TDataTypeRelationOne.SetupControl(Control: TWinControl); 256 268 begin 257 TEdit (Control).Text := SelectedItemName;269 TEditButton(Control).Text := SelectedItemName; 258 270 end; 259 271 … … 261 273 begin 262 274 SelectedItemName := CellValue; 275 end; 276 277 procedure TDataTypeRelationOne.LoadDef(ACustomType: Integer); 278 var 279 DbRows: TDbRows; 280 begin 281 try 282 DbRows := TDbRows.Create; 283 Core.System.Database.Select(DbRows, TypeRelationOne, '*', 'CustomType=' + IntToStr(ACustomType)); 284 ObjectId := StrToInt(DbRows[0].Values['Object']); 285 finally 286 DbRows.Free; 287 end; 263 288 end; 264 289 … … 420 445 end; 421 446 422 procedure TDataType.LoadDef( CustomType: Integer);447 procedure TDataType.LoadDef(ACustomType: Integer); 423 448 begin 424 449
Note:
See TracChangeset
for help on using the changeset viewer.