From Clomosy Docs

No edit summary
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 8: Line 8:


You cannot create a procedure without making the following definitions on this page;<br>
You cannot create a procedure without making the following definitions on this page;<br>
:'''Forms:''' PROJECT.SCRIPT
:<b>Forms:</b> PROJECT.SCRIPT
:'''User/Normal:''' Procedure
:<b>User/Normal:</b> Procedure
:'''Events:''' New Code
:<b>Events:</b> New Code


Then you should write the name you will give the procedure in the "Param_Name" field. In this way, you can start the coding and complete your process by pressing the save button after the coding is finished.<br>
Then you should write the name you will give the procedure in the "Param_Name" field. In this way, you can start the coding and complete your process by pressing the save button after the coding is finished.<br>
Line 21: Line 21:
</div>
</div>


'''Example:'''<br>
<b>Example</b><br>
In the example, let's put a button on our home page and when it is clicked, the procedure we defined will go. First, let's create a procedure.<br>
In the example, let's put a button on our home page and when it is clicked, the procedure we defined will go. First, let's create a procedure.<br>


''Code defined in the procedure;''<br>
<i>Code defined in the procedure;</i><br>


'''TRObject Syntax'''<br>
<pre>
<pre>
var
var
   MyForm:TFrmClomosyBasisForm;
   MyForm:TclForm;
   lblCaption : TclProLabel;
   lblCaption : TclProLabel;


{
{
   MyForm = TFrmClomosyBasisForm.Create(Self);
   MyForm = TclForm.Create(Self);
   MyForm.SetFormColor('#CBEDD5','#E6E2C3',clGVertical);
   MyForm.SetFormColor('#CBEDD5','#E6E2C3',clGVertical);
    
    
   lblCaption = MyForm.AddNewProLabel(MyForm,'lblCaption','');
   lblCaption = MyForm.AddNewProLabel(MyForm,'lblCaption','Welcome!');
   clComponent.SetupComponent(lblCaption,'{"Caption":"Welcome!","Align" : "Center","Width" :170, "Height":30,
   lblCaption.Align = AlCenter;
   "TextColor":"#4d6e56","TextSize":35,"TextVerticalAlign":"center",
  lblCaption.Width = 170;
   "TextHorizontalAlign":"left","TextBold":"yes"}');
  lblCaption.Height = 30;
   lblCaption.clProSettings.FontColor = clAlphaColor.clHexToColor('#4d6e56');
  lblCaption.clProSettings.TextSettings.Font.Style = [fsBold];
  lblCaption.clProSettings.FontSize = 35;
   lblCaption.clProSettings.FontVertAlign = palcenter;
  lblCaption.clProSettings.FontHorzAlign = palLeading;
  lblCaption.SetclProSettings(lblCaption.clProSettings);
 
   MyForm.Run;
   MyForm.Run;
}
}
</pre>
</pre>


'''Base Syntax'''<br>
<pre>
var
  MyForm:TFrmClomosyBasisForm;
  lblCaption : TclProLabel;
begin
  MyForm := TFrmClomosyBasisForm.Create(Self);
  MyForm.SetFormColor('#CBEDD5','#E6E2C3',clGVertical);
 
  lblCaption := MyForm.AddNewProLabel(MyForm,'lblCaption','');
  clComponent.SetupComponent(lblCaption,'{"Caption":"Welcome!","Align" : "Center","Width" :170, "Height":30,
  "TextColor":"#4d6e56","TextSize":35,"TextVerticalAlign":"center",
  "TextHorizontalAlign":"left","TextBold":"yes"}');
  MyForm.Run;
end;
</pre>


''Code defined in the Main Code;''<br>
<i>Code defined in the Main Code;</i><br>


'''TRObject Syntax'''<br>
<pre>
<pre>
var
var
   MyForm:TFrmClomosyBasisForm;
   MyForm:TclForm;
   btnShow : TclButton;
   btnShow : TclButton;
void switchScreen
void switchScreen
Line 75: Line 63:


{
{
   MyForm = TFrmClomosyBasisForm.Create(Self);
   MyForm = TclForm.Create(Self);
   btnShow= MyForm.AddNewButton(MyForm,'btnShow','Go!');
   btnShow= MyForm.AddNewButton(MyForm,'btnShow','Go!');
   btnShow.TextSettings.Font.Size=50;
   btnShow.TextSettings.Font.Size=50;
Line 86: Line 74:
</pre>
</pre>


'''Base Syntax'''<br>
<b>Output:</b><br>
<pre>
[[File:ExampleProcedure.png|650px|frameless]]
var
  MyForm:TFrmClomosyBasisForm;
  btnShow : TclButton;
procedure switchScreen
begin
  Clomosy.ExecProjectProcedure('LoginScreen',Nil,'');
end;


begin
{{#seo:|description=Learn the essentials of procedure creation and execution for better app performance.}}
  MyForm := TFrmClomosyBasisForm.Create(Self);
  btnShow:= MyForm.AddNewButton(MyForm,'btnShow','Go!');
  btnShow.TextSettings.Font.Size:=50;
  btnShow.Align := alCenter;
  btnShow.Height := 50;
  btnShow.Width := 100;
  MyForm.AddNewEvent(btnShow,tbeOnClick,'switchScreen');
  MyForm.Run;
end;
</pre>
 
'''Output:'''<br>
[[File:ExampleProcedure.png|650px|frameless]]

Latest revision as of 10:39, 20 December 2024

They are used to practically run these operations, which are the subprogram, that is, the procedure, where the operations that need to be run repeatedly are defined and by calling this definition. Of course, procedures just run the process, they don't return a value.

We can define and call procedures in Main Code on Clomosy. Apart from this, it is also called by entering the Management> Codes section. Now let's explain how to do this through an example.

You cannot create a procedure without making the following definitions on this page;

Forms: PROJECT.SCRIPT
User/Normal: Procedure
Events: New Code

Then you should write the name you will give the procedure in the "Param_Name" field. In this way, you can start the coding and complete your process by pressing the save button after the coding is finished.

The following code must be written to call this procedure in the Main Code.

Example
In the example, let's put a button on our home page and when it is clicked, the procedure we defined will go. First, let's create a procedure.

Code defined in the procedure;

var
  MyForm:TclForm;
  lblCaption : TclProLabel;

{
  MyForm = TclForm.Create(Self);
  MyForm.SetFormColor('#CBEDD5','#E6E2C3',clGVertical);
  
  lblCaption = MyForm.AddNewProLabel(MyForm,'lblCaption','Welcome!');
  lblCaption.Align = AlCenter;
  lblCaption.Width = 170;
  lblCaption.Height = 30;
  lblCaption.clProSettings.FontColor = clAlphaColor.clHexToColor('#4d6e56');
  lblCaption.clProSettings.TextSettings.Font.Style = [fsBold];
  lblCaption.clProSettings.FontSize = 35;
  lblCaption.clProSettings.FontVertAlign = palcenter;
  lblCaption.clProSettings.FontHorzAlign = palLeading;
  lblCaption.SetclProSettings(lblCaption.clProSettings);
  
  MyForm.Run;
}


Code defined in the Main Code;

var
  MyForm:TclForm;
  btnShow : TclButton;
void switchScreen
{
  Clomosy.ExecProjectProcedure('LoginScreen',Nil,'');
}

{
  MyForm = TclForm.Create(Self);
  btnShow= MyForm.AddNewButton(MyForm,'btnShow','Go!');
  btnShow.TextSettings.Font.Size=50;
  btnShow.Align = alCenter;
  btnShow.Height = 50;
  btnShow.Width = 100;
  MyForm.AddNewEvent(btnShow,tbeOnClick,'switchScreen');
  MyForm.Run;
}

Output:
ExampleProcedure.png