Jump to content

Function Form by Form variable, problem?


eduardo.junqueira

Recommended Posts

Are there any problems with changing the code below?

==================================================

 

function UniForm1: TUniForm1;
begin
  Result := TUniForm1(UniMainModule.GetFormInstance(TUniForm1));
end;
 
 
By the form variable
==================================================
 
type
  TUniForm1 = class(TUniForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
UniForm1: TUniForm1;
 
implementation
 
{$R *.dfm}

 

Link to comment
Share on other sites

  • Administrators

There is a big problem here.uniGUI can not work with global variables. That's why we use a function to retrieve correct instance of a form class for current session.

You can also define a Free Form and create an instance in your code.

var MyForm : TUniForm1;
begin
  MyForm := TUniForm1.Create(UniApplication); 
  MyForm.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...