Jump to content

Cant create overloaded function


dryphon

Recommended Posts

Hi

 

I am new, testing framework.

 

Get error on Fr := TFrm1Class(FrC).Create

[dcc32 Error] Main.pas(339): E2250 There is no overloaded version of 'Create' that can be called with these arguments

var
  Nd : TUniTreeNode;
  Ts : TUniTabSheet;
  FrC : TFrm1Class;
  Fr : TUniForm;
  FClassName, iconfile: string;
  index: Integer;
  keyvalue:Real;
begin
  Nd := NavTree.Selected;
  if Nd.Count = 0 then
  begin
    Ts := Nd.Data;
    if not Assigned(Ts) then
    begin
      FClassName := 'T'+FormNames.Values[IntToStr(NativeInt(Nd))];
      if UniMainModule.qMenus.Locate('FORMNAME',FClassName,[loPartialKey]) then
      begin
        try
          keyvalue:=UniMainModule.qMenus.FieldValues['KEYVALUE'];
          if keyvalue=999 then keyvalue:=UniMainModule.UserOid;

          FrC := TFrm1Class(FindClass('T' + FormNames.Values[IntToStr(NativeInt(Nd))]));
          if not FrC.InheritsFrom(TFrm1) then
            exit;
          Ts := TUniTabSheet.Create(Self);
          Ts.PageControl := UniPageControl1;

          Ts.Closable := True;
          Ts.OnClose := TabSheetClose;
          Ts.Tag := NativeInt(Nd);
          Ts.Caption := Nd.Text;
          Ts.ImageIndex := Nd.ImageIndex;

          Fr := TFrm1Class(FrC).Create(UniApplication,UniMainModule.qMenus.FieldValues['OBJECTMODE'],keyvalue,False,0,'','','');
          Fr.Align := alClient;
          Fr.Parent := Ts;

          Nd.Data := Ts;
        except
          ShowMessage('Bilinmeyen Hata!!!');
        end;
      end;
    end;
    UniPageControl1.ActivePage := Ts;
  end;
end;

form code

TFrm1Class = class of TFrm1;

  TFrm1 = class(TFrm)
    ilaMain: TUniImageListAdapter;
    aclMain: TActionList;
    actClose: TAction;
    cpToolbar: TUniContainerPanel;
    UniToolBar1: TUniToolBar;
    tbClose: TUniToolButton;
    procedure actCloseExecute(Sender: TObject);
  private
    { Private declarations }
    FArgs: TErgoVariantList;
    FIsModal: Boolean;
    FKeyValue: integer;
    FObjectState: TKBObjectState;
    FNewState: Integer;
    FWhereSql: string;
    FSearchField: string;
    FSearchText: string;
    FServiceName: string;
    FServiceVersion: string;
  public
    { Public declarations }
    LinkedFrameClass: TFrm1Class;
    constructor Create(
      AOwner: TComponent;
      AObjectState: TKBObjectState = osBrowse;
      AKeyValue: Integer = -1;
      AIsModal: Boolean = False;
      ANewState: Integer = 0;
      AWhereSql: string = '';
      ASearchField: string = '';
      ASearchText: string = ''); overload;
    constructor Create(
      AOwner: TComponent;
      AArgs: array of variant); overload;
    destructor Destroy; override;
    property IsModal: Boolean read FIsModal;
    property KeyValue: integer read FKeyValue write FKeyValue;
    property ObjectState: TKBObjectState read FObjectState write FObjectState;
    property NewState: integer read FNewState write FNewState;
    property WhereSql: string read FWhereSql;
    property SearchField: string read FSearchField;
    property SearchText: string read FSearchText;
    property Args: TErgoVariantList read FArgs;
  end;

implementation

{$R *.dfm}

uses
  MainModule, uniGUIApplication,uniPageControl,uException;

constructor TFrm1.Create(
  AOwner: TComponent;
  AObjectState: TKBObjectState = osBrowse;
  AKeyValue: Integer = -1;
  AIsModal: Boolean = False;
  ANewState: Integer = 0;
  AWhereSql: string = '';
  ASearchField: string = '';
  ASearchText: string = '');
begin
  inherited Create(AOwner);
  FObjectState := AObjectState;
  FKeyValue := AKeyValue;
  FIsModal := AIsModal;
  FNewState := ANewState;
  FWhereSql := AWhereSql;
  FSearchField := ASearchField;
  FSearchText := ASearchText;
{  if AIsModal then
    FormStyle := fsNormal
  else
    FormStyle := fsMDIChild; }
end;

constructor TFrm1.Create(
  AOwner: TComponent;
  AArgs: array of variant);
begin
  // Check parameters.
  if length(AArgs) < 7 then
    ErgoRaiseException('Invalid number of arguments');
  inherited Create(AOwner);
  FArgs := TErgoVariantList.Create(AArgs);

  FObjectState := AArgs[0];
  FKeyValue := AArgs[1];
  FIsModal := AArgs[2];
  FNewState := AArgs[3];
  FWhereSql := AArgs[4];
  FSearchField := AArgs[5];
  FSearchText := AArgs[6];
{  if FIsModal then
    FormStyle := fsNormal
  else
    FormStyle := fsMDIChild; }
end;

destructor TFrm1.Destroy;
begin
  FArgs.Free;
  inherited;
end;

procedure TFrm1.actCloseExecute(Sender: TObject);
var
  Ts : TUniTabSheet;
begin
  inherited;
  if not IsModal then
  begin
    Ts := Parent as TUniTabSheet;
    Ts.Close;
  end;
end;

initialization
  RegisterClass(TFrm1);

end.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...