What is #Region and anyone can help me explain in what case we should use this - Module 5: Infobase

For students who study 1C Mobile course.

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Jan 11, 2021
Company: Robot cho mọi người

Hi everyone,
I am reading the code in the sample Inforbase of Module 5 and I see #region.


And I did try to find its information in CTRL+F1 but it is quite short.


Anyone can help me explain what is #Region in the code and What we should use this for?

Thank you.

 
#2
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello,

in the 1C language, it's possible to combine code in areas (regions). They are convenient in that they can be collapsed and expanded, just like procedures and functions. This improves the readability of our code, for example, we can collapse a query that is too long, or we can merge several procedures into a scope.

Code
#Region LibrariesHandlers

// StandardSubsystems.AttachableCommands
&AtClient
Procedure Attachable_ExecuteCommand(Command)
   AttachableCommandsClient.ExecuteCommand(ThisObject, Command, Object);
EndProcedure

&AtServer
Procedure Attachable_ExecuteCommandAtServer(Context, Result)
   AttachableCommands.ExecuteCommand(ThisObject, Context, Object, Result);
EndProcedure

&AtClient
Procedure Attachable_UpdateCommands()
   AttachableCommandsClientServer.UpdateCommands(ThisObject, Object);
EndProcedure
// End StandardSubsystems.AttachableCommands

#EndRegion


You can read more details in the help (syntax - assistant)

Download 1.png (37.43 KB)
 
#3
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Jan 11, 2021
Company: Robot cho mọi người

So #Region is used to combine Function and procedure and the code still run with out function, right?

 
#4
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Yes, this does not affect the execution of the code. This instruction is only needed for the convenience of the developer.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.