Добавление свойсва у движка

lvilvi
отредактировано 06:23 Раздел: FastReport 3.0
Значит хочу свой движок сделать - вот описание

unit frxCDSComponents;

interface

uses
Classes, frxClass, frxCustomDB, DB, DBClient, frxDsgnIntf, frxCDSEditor;

type
TfrxClientDataSet = class(TfrxCustomQuery)
private
FClientDataSet: TClientDataSet;
SQL: TStrings;
protected
procedure SetSQL(Value: TStrings); override;
function GetSQL: TStrings; override;
procedure OnChangeSQL(Sender: TObject); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
class function GetDescription: String; override;
property ClientDataSet: TClientDataSet read FClientDataSet;
published
property EditFields: Booleab
end;

implementation

{ TfrxClientDataSet }

constructor TfrxClientDataSet.Create(AOwner: TComponent);
begin
FClientDataSet := TClientDataSet.Create(nil);
DataSet := FClientDataSet;
SQL := TStringList.Create;
inherited;
end;

destructor TfrxClientDataSet.Destroy;
begin
SQL.Free;
inherited;
end; {End TfrxClientDataSet.Destroy}

class function TfrxClientDataSet.GetDescription: String;
begin
Result := 'ClientDataSet';
end; {End TfrxClientDataSet.GetDescription}

procedure TfrxClientDataSet.SetSQL(Value: TStrings);
begin
SQL := Value;
end; {End TfrxClientDataSet.SetSQL}

function TfrxClientDataSet.GetSQL: TStrings;
begin
Result := SQL;
end; {End TfrxClientDataSet.GetSQL}

procedure TfrxClientDataSet.OnChangeSQL(Sender: TObject);
begin
FClientDataSet.CommandText := FClientDataSet.Params.ParseSQL(SQL.Text, True);
inherited;
end; {End TfrxClientDataSet.OnChangeSQL}

procedure TfrxClientDataSet.Notification(AComponent: TComponent;
Operation: TOperation);
begin
if (Operation = opInsert) and not FClientDataSet.Active then
begin
with FClientDataSet do
begin
with FieldDefs.AddFieldDef do
begin
Name := 'NEW';
DataType := ftString;
Size := 15;
end;
CreateDataSet;
end;
end;
inherited;
end; {End TfrxClientDataSet.Notification}

initialization
frxObjects.RegisterObject1(TfrxClientDataSet, nil, '', 'BDE', 0, 39);

end.

// ============================================
К нему хочу сделать редактор полей (уже готов , только прикрутить), вот как свойство описываю

unit frxCDSEditor;

interface

uses
Classes, Dialogs;

implementation

uses
frxDsgnIntf, frxCDSComponents;

type
TfrxFieldsProperty = class(TfrxClassProperty)
public
function GetAttributes: TfrxPropertyAttributes; override;
function Edit: Boolean; override;
end;

{ TfrxFieldsProperty }

function TfrxFieldsProperty.Edit: Boolean;
begin
ShowMEssage('sdsd');
Result := True;
end; {TfrxFieldsProperty.Edit}

function TfrxFieldsProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paDialog, paReadOnly];
end; {End TfrxFieldsProperty.GetAttributes}


initialization
frxPropertyEditors.Register(TypeInfo(TStrings), TfrxClientDataSet, 'EditFields',
TfrxFieldsProperty);

end.



...............................

Но чего то не хватает , так как этого свойства у объекта не видно

Комментарии

  • отредактировано 06:23
    Св-во EditFields типа boolean, при чем тут TStrings?

Оставить комментарий

Многофункциональный текстовый редактор. Чтобы отредактировать стиль параграфа, нажмите TAB, чтобы перейти к меню абзаца. Там вы можете выбрать стиль. По умолчанию не выбран ни один стиль. Когда вы выберете текст, появится встроенное меню форматирования. Нажмите TAB, чтобы войти в него. Некоторые элементы, такие как многофункциональные вставки ссылок, картинок, индикаторов загрузки и сообщений об ошибок могут быть вставлены в редактор. Вы можете перемещаться по ним, используя стрелки внутри редактора и удалять с помощью клавиш delete или backspace.