From Clomosy Docs
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','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; }