From Clomosy Docs
No edit summary |
No edit summary |
||
| 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> | ||
: | :<b>Forms:</b> PROJECT.SCRIPT | ||
: | :<b>User/Normal:</b> Procedure | ||
: | :<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> | ||
<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> | ||
<i>Code defined in the procedure;</i><br> | |||
<pre> | <pre> | ||
var | var | ||
| Line 44: | Line 43: | ||
</pre> | </pre> | ||
<i>Code defined in the Main Code;</i><br> | |||
<pre> | <pre> | ||
var | var | ||
| Line 86: | Line 67: | ||
</pre> | </pre> | ||
<b>Output:</b><br> | |||
</ | |||
[[File:ExampleProcedure.png|650px|frameless]] | [[File:ExampleProcedure.png|650px|frameless]] | ||
Revision as of 12:34, 13 November 2024
Only Premium accounts can be used.
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.
Clomosy.ExecProjectProcedure('Procedurename',Nil,'');
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','');
clComponent.SetupComponent(lblCaption,'{"Caption":"Welcome!","Align" : "Center","Width" :170, "Height":30,
"TextColor":"#4d6e56","TextSize":35,"TextVerticalAlign":"center",
"TextHorizontalAlign":"left","TextBold":"yes"}');
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;
}