in Delphi language, create a unit that uses interposer technique to add to every…
- User
in Delphi language, create a unit that uses interposer technique to add to every TComponent descendant a property of type TQryRecInfo named ORMRec and a property string named ORMRecField.
Adjust the changes to the unit below:
unit interposer_class;
interface
uses Vcl.Forms, Vcl.Controls, CommCtrl, Messages, sPanel, sEdit, sPageControl, System.Classes, AdvCGrid, Uni, pixel_classes;
{$TYPEINFO ON}
type TForm = class(Vcl.Forms.TForm) protected procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end;
TsPanel = class(sPanel.TsPanel) protected procedure CreateParams(var Params: TCreateParams); override; end;
TsEdit = class(sEdit.TsEdit) protected procedure CreateParams(var Params: TCreateParams); override; end;
TsPageControl = class(sPageControl.TsPageControl) protected procedure CreateParams(var Params: TCreateParams); override; private procedure TCMAdjustRect(var Msg: TMessage); message TCM_ADJUSTRECT; end;
TAdvColumnGrid = class(AdvCGrid.TAdvColumnGrid) private FByPassAF: TArray; function GetCellz(ACol, ARow: Integer): TZString; procedure SetCellz(ACol, ARow: Integer; const Value: TZString); function GetBypassAF(ACol: Integer): Boolean; procedure SetBypassAF(ACol: Integer; const Value: Boolean); protected procedure CreateParams(var Params: TCreateParams); override; public property Cellz[ACol, ARow: Integer]: TZString read GetCellz write SetCellz; property BypassAutoFit[ACol: Integer]: Boolean read GetBypassAF write SetBypassAF; published function CriaLinhaObjeto(MyObject: TObject): Integer; function CriaLinha: Integer; function GetColumnIndexByName(const nome: string): Integer; procedure SetBasicColumnConfig; end;
implementation
uses pixel_utils, System.Math, System.Types, Windows, System.SysUtils, TypInfo, Generics.Collections, Data.DB, Vcl.Graphics, ComCtrls, Vcl.Grids;
procedure TForm.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); StrPCopy(Params.WinClassName, 'ZPro'); end;
constructor TForm.Create(AOwner: TComponent); begin inherited; end;
destructor TForm.Destroy; begin inherited; end;
procedure TsPanel.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); StrPCopy(Params.WinClassName, 'Painel'); end;
procedure TsEdit.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); StrPCopy(Params.WinClassName, 'Editor'); end;
procedure TsPageControl.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); StrPCopy(Params.WinClassName, 'PagCtrl'); end;
procedure TsPageControl.TCMAdjustRect(var Msg: TMessage); begin inherited; case TabPosition of tpTop: begin PRect(Msg.LParam)^.Left:= 0; PRect(Msg.LParam)^.Right:= ClientWidth; PRect(Msg.LParam)^.Bottom:= ClientHeight;
- Assistant
- User
review and tell me why this error occurs on the code snippet below: [dcc32 Error] interposer_class.pas(30): E2037 Declaration of 'Create' differs from previous declaration
TForm = class(Vcl.Forms.TForm) protected procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end;
- Assistant
The error message
[dcc32 Error] interposer_class.pas(30): E2037 Declaration of 'Create' differs from previous declarationtypically indicates that there's a mismatch between the parameters or the signature of theCreateconstructor in yourTForminterposer class and its ancestor class (Vcl.Forms.TForm).Let's check the potential causes for this error:
- User
I want that TForm is an interposer os TForm that inherits from the interposed TComponent Please review and adjust
- Assistant