Jump to content

Can Create Multi instance of FormClass?


newsanti

Recommended Posts

UniGuiMainmodule create only one instance of a Formclass? Can Create more than one instance?

 

function TjgCustomWebFormCell.CreateInnerForm: TObject;

var

oFormClass: TClass;

begin

oFormClass:=Properties['FormClass'].AsClass;

Result:=UniApplication.UniMainModule.GetFormInstance(oFormClass,True);

end;

Link to comment
Share on other sites

UniGuiMainmodule create only one instance of a Formclass? Can Create more than one instance?

 

function TjgCustomWebFormCell.CreateInnerForm: TObject;

var

oFormClass: TClass;

begin

oFormClass:=Properties['FormClass'].AsClass;

Result:=UniApplication.UniMainModule.GetFormInstance(oFormClass,True);

end;

 

function TjgCustomWebFormController.CreateInnerForm: TObject;

var

oFormClass: TClass;

begin

oFormClass:=FormCell.Properties['FormClass'].AsClass;

Result:=TUniFormClass(oFormClass).Create(UniApplication); //for multiple instance of uniForm

end;

Link to comment
Share on other sites

Create simple form or if you have created application forms then....

unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIForm;
type
 TUniForm1 = class(TUniForm)
 private
   { Private declarations }
 public
   { Public declarations }
 end;

// function UniForm1: TUniForm1;  // Remove

implementation

{$R *.dfm}

uses
 MainModule, uniGUIApplication;

// function UniForm1: TUniForm1;                                              // Remove
// begin                                                                      // Remove
//   Result := TUniForm1(UniMainModule.GetFormInstance(TUniForm1));           // Remove
// end;                                                                       // Remove  

end.

 


Uses uniGUIApplication,

procedure UniButton1Click(Sender: TObject);
begin
  // first instance 
  with TUniForm1.Create(UniApplication) do begin
     Show;
  end;
  // Second instance 
  with TUniForm1.Create(UniApplication) do begin
     Show;
  end;
end;

procedure UniButton2Click(Sender: TObject);
var
  FormA,FormB: TUniForm1;   
begin
  // first instance 
  FormA:= TUniForm1.Create(UniApplication);
  FormA.Show;

  // Second instance 
  FormB:= TUniForm1.Create(UniApplication);
  FormB.Show;
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...