Jump to content
uniGUI Discussion Forums
eduardo.junqueira

Function Form by Form variable, problem?

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}

 

Share this post


Link to post
Share on other sites

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;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×