unit Un_TpsCachedUpdatesEditor;
interface
uses
DesignIntf,TypInfo,DesignEditors,
Classes ,DBTables;
type
TDataSetMemberProperty = class (TClassProperty)
public
function GetAttributes: TPropertyAttributes;override;
function GetValue: string; override;
procedure SetValue(const Value:string); override;
procedure GetValues(Proc: TGetStrProc); override;
end;
procedure Register;
implementation
uses
Un_TpsCachedUpdates;
procedure Register;
begin
RegisterComponents('My Components',[TpsCachedUpdates]);
end;
{ TDataSetMemberProperty }
function TDataSetMemberProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paSubProperties, paValueList, paSortList, paRevertable];
end;
function TDataSetMemberProperty.GetValue: string;
begin
if TDataSetMember(GetOrdValue).DataSet=nil then
Result:=''
else begin
Result:=TDataSetMember(GetOrdValue).DataSet.Name;
end;
end;
procedure TDataSetMemberProperty.GetValues(Proc: TGetStrProc);
begin
Designer.GetComponentNames(GetTypeData(TypeInfo(TDBDataSet)), Proc);
end;
procedure TDataSetMemberProperty.SetValue(const Value: string);
var
Component: TComponent;
begin
if Value = '' then
Component := nil
else begin
Component := Designer.GetComponent(Value);
if not (Component is GetTypeData(TypeInfo(TDBDataSet))^.ClassType) then
raise EPropertyError.CreateRes(@sClassNotApplicable);//(@SInvalidPropertyValue);
end;
TDataSetMember(GetOrdValue).DataSet:=Component as TDBDataSet;
Designer.Modified;
end;
end.
Сайт управляется системой
uCoz