From Clomosy Docs

It is a method used to run or redirect to a specific unit. This allows for the dynamic loading and utilization of units.

Its purpose is to activate the functionality of a specific unit and to interact with that unit. By running the unit, the code, functions, and procedures within it become accessible.

It is typically called in response to user interactions or specific events to open or execute units. For example, a unit can be run when a user clicks a button.

Example 1

Main Code:

Clomosy.RunUnit('uLogin');

uLogin:

ShowMessage('Hello, you have been redirected from the main code to the uLogin unit.');

Example 2
In the example above, the "uLogin" unit was created. In this example, components have been added to both the "Main Code" and "uLogin" pages. Here, when a button in the "Main Code" is pressed, it navigates to the "uLogin" unit, and when the page within this unit is clicked, it returns to the "Main Code" page.

Main Code:

var
  Form1:TCLForm;
  buton1 : TclButton;
void goToLogin;
{
  Clomosy.RunUnit('uLogin');
}
{
  Form1 = TCLForm.Create(Self);
  
  buton1 = Form1.AddNewButton(Form1,'buton1','Go to uLogin');
  buton1.Width = 150;
  Form1.AddNewEvent(buton1,tbeOnClick,'goToLogin');
  
  Form1.Run;
}

uLogin:

var
  formLogin:TCLForm;
  btnLogin : TclButton;
void goToMainCode;
{
  formLogin.clHide;
}
{
  formLogin = TCLForm.Create(Self);
  
  btnLogin = formLogin.AddNewButton(formLogin,'btnLogin','Go to Main Code');
  btnLogin.Width = 150;
  formLogin.AddNewEvent(btnLogin,tbeOnClick,'goToMainCode');
  
  formLogin.Run;
}

See Also