Zuerst der Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73:
| unit QDbfStdCtrls;
interface
uses Windows, Messages, SysUtils, Classes, QControls, QStdCtrls, QMask, QxDatabase, DesignEditors, DesignIntf;
type TBDFEdit = class(TCustomMaskEdit) private FDatabase : TQDatabase; FField : string; FFieldList : TStringList; protected public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property DataSource: TQDatabase read FDatabase write FDatabase; property DataField: string read FField write FField; end;
TFieldProperty = class(TStringProperty) public function GetAttributes: TPropertyAttributes; override; procedure GetValues(Proc: TGetStrProc); override; end;
procedure Register;
implementation
procedure Register; begin RegisterPropertyEditor(TypeInfo(string), TBDFEdit, 'DataField', TFieldProperty); RegisterComponents('ABase', [TBDFEdit]); end;
constructor TBDFEdit.Create(AOwner: TComponent); begin inherited Create(AOwner); FFieldList := TStringList.Create; FFieldList.Add('Feld 1'); FFieldList.Add('Feld 2'); FFieldList.Add('Feld 3'); end;
destructor TBDFEdit.Destroy; begin FFieldList.Free; inherited Destroy; end;
function TFieldProperty.GetAttributes: TPropertyAttributes; begin Result := [paValueList, paSortList]; end;
procedure TFieldProperty.GetValues(Proc: TGetStrProc); begin Proc('Feld 1'); Proc('Feld 2'); Proc('Feld 3');
end;
end. |
Und nun die Frage
Wie stelle ich es an, das ich innerhalb von
TFieldProperty.GetValues auf die StringListe aus
TBDFEdit (FFieldList) zugreifen kann?