1c general command ordinary forms. We unify command execution interfaces. Grouping Objects

Most modern software is developed by teams of programmers. Someone is responsible for the user interface, someone for the core, and someone for additional modules. To ensure that the work of all these people does not go to waste, it is necessary to correctly combine the different parts of the project, while not forgetting about its possible expansion. To do this, we will need the “Team” design pattern, which encapsulates the performer of the task and its conditions.

Let's imagine that we work in a company that writes complex multi-component software. The project is highly specialized and has many different modules, the number of which can expand over time. Our task is to write a flexible and convenient hotkey system for this program. The set of possible combinations is limited to hotkeys from before , and also includes the ctrl-z combination to undo the action.

It would seem that everything is simple: I coded a large switch block, which, when different combinations of buttons are pressed, calls one or another function of a module, and rejoice. But, firstly, this approach is not flexible. When the project adds new modules or hotkeys, we will have to change the code for this bloated branch statement, which will cause it to become even more bloated. And secondly, the management wrote in big red letters that the user should be able to reassign these hotkeys. Thus, we definitely won’t be able to hardcode commands into the switch code.

Looking at the code of the project modules and the lists of their commands that can be assigned to hotkeys, we are even more convinced that we will have to suffer a lot before we come up with a more or less working architecture for all this.

Module interfaces accessible through HotKeys class Calculator ( public: void runCalc(); void closeCalc(); ) class Printer ( public: void printDocument(); void printImage(); void printEmail(); ) class Browser ( public: void runBrowser(); void closeBrowser(); ) // And then there are many different classes

Team Pattern

Putting aside the lyrics, let's move on to studying the “Team” pattern, which should help us in this difficult task. First we need to figure out what we have. We have many modules with a wide variety of APIs. We also have a window in which the user can select from a list one of the commands provided by the modules and assign it to a specific keyboard shortcut.

Formally speaking, the keyboard handler is the client, the API functions of modules called by hotkeys are tasks, and the modules that provide these tasks are executors. The hotkeys settings window is a kind of intermediary between the client and the performer, hiding all the details of the operations being performed. This structure allows the client to be completely separated from the executor, that is, the user has no idea which module is running when a particular key combination is pressed and what it is doing. And this is very good, since the better the parts of the code are isolated from each other, the more reliable the program works.

For such isolation, we need to define a command object, and therefore a corresponding interface. It is quite simple and defines only one execute() method, which should execute a method of any of the modules.

Interface of the “Commands” object class Command ( public: void execute() = 0; )

To define a specific object, we simply declare a new class that inherits the Command interface and define its execute() method. Let's say we want to create a command that launches a calculator. To do this, we will create a RunCalcCommand class that will inherit the Command interface and override execute() to call the runCalc() method of the Calculator module.

Command to run the calculator class RunCalcCommand: public Command ( Calculator *calc; public: RunCalcCommand(Calculator *excalc) ( calc = excalc; ) void execute() ( calc->runCalc(); ) )

If you look closely at the command code, you will notice that a pointer to the Calculator module is passed in the constructor of the RunCalcCommand class. This is done for greater flexibility. In the future, we may have a ModernCalculator class that calls an advanced version of the calculation program. By using composition, that is, without strictly fixing the performer in the code, we increase the isolation of the code, which will save time in the future.

Now you need to associate the command with the hotkey. To do this, you can create an array of pointers to objects of the Command class. The size of the array will be equal to the number of supported hotkeys. Each element of the command array is mapped to a specific hotkey. In our case, to do this, we can convert the value of the button, which together with Ctrl makes up any of the possible combinations, into a numeric value. If we were using shortcuts like ctrl-a to ctrl-k, we would need a slightly different approach.

Having received the code of the pressed key combination and converted it into the corresponding index for the array of commands, we can safely call the execute() method of the object, the pointer to which is located in the desired cell of the array.

Assigning a command to a hotkey and launching it // Command and hotkey initialization code const int comCount = 10; Command* commands; Calculator *calc = new Calculator(); commands = new RunCalcCommand(calc); // Code in the keyboard press handler // Get the pressed keys hotkey = catchHotKey(); // Convert them into an index and run the command int index = hotkey2index(hotkey); commands->execute();

It's all quite simple. You can define several more Command descendants that will perform specific actions and associate them with hotkeys. This architecture allows you to completely separate the client from the executors. The keyboard handler has no idea which module is processing the command and what exactly it is doing, and the modules, in turn, have no idea that they are accessed using hotkeys and not in some other way.

Cancel command

Everything seems to be fine, but we completely forgot about the cancellation. The ctrl-z keyboard shortcut should undo the effect of the last command. Implementing cancellation is quite simple, although at first glance it may not seem so. To do this, we'll change the Command interface a little.

Command class that supports undoing class Command ( public: void execute() = 0; void undo() = 0; ) class RunCalcCommand: public Command ( Calculator *calc; public: RunCalcCommand(Calculator *excalc) ( calc = excalc; ) void execute() ( calc->runCalc(); ) void undo() ( calc->closeCalc(); ) )

We simply added the undo() method, which must be overridden in descendant classes. The programmer himself decides which module function the cancel method will use. Thus, the undo() method for RunCalcCommand will call the closeCalc() function of the Calculator module. We will also need to tweak the keyboard handler code a bit.


Wikipedia about the “Team” pattern. Keyboard handler with cancel support // Command and hotkey initialization code const int comCount = 10; Command* commands; Command *lastCommand = new NoCommand(); Calculator *calc = new Calculator(); commands = new RunCalcCommand(calc); // Code in the keyboard press handler // Get the pressed keys HotKey *hotkey = catchHotKey(); // If this is a cancellation, then call the corresponding method if (hotkey->str() == "ctrl-z") ( lastCommand->undo(); ) // Processing other combinations

Here we simply store a pointer to the last command used in the lastCommand variable and call the corresponding method when pressing ctrl-z. Additionally, we resort to a little trick using the empty command object NoCommand. The code for this class looks like this:

Empty command NoCommand class NoCommand: public Command ( public: void execute() (); void undo() (); )

Such stub objects are used quite often. They are needed to reduce the number of null pointer checks. If lastCommand were NULL, then before calling the undo() method we would have to check the correctness of the value of this pointer, which is undesirable, since one day we might forget to do this, as a result of which the program will crash. It is recommended to use the same stub objects for other hotkeys that are not assigned the corresponding commands.

By the way, the keyboard handler code can be modified so that it supports canceling not only the last operation, but also all chains of executed commands. To do this, you should use a stack instead of a simple pointer to the last command. When processing any hotkey, a pointer to the corresponding command will be added to the stack. This way we will get a complete history of command calls, which will allow us to cancel everything one by one using ctrl-z.


Macros

Macros are one of the greatest inventions of mankind, helping them save tons of time. Our pattern allows you to implement macro commands with just a few extra lines of code. First, let's define a class responsible for the logic of group execution of operations.

Macro command class MacroCommand: public Command ( Command *commands; int comCount; public: MacroCommand(Command *comArray, int elemCount) ( commands = comArray; comCount = elemCount; ) void execute() ( for (int i = 0; i< comCount; i++) { commands[i]->execute(); ) ) void undo() ( for (int i = 0; i< comCount; i++) { commands[i]->undo(); ) ) )

As you can see, the MacroCommand class is a successor to Command and overrides the same execute and undo methods. In the interface, it differs from a regular command only in its constructor. This class does not accept a pointer to the execution module, but an array of pointers to simple commands. The execute() code simply goes through the elements of the array and calls each one. undo() behaves the same way. The keyboard handler, when accessing a command object, has no idea whether it is a macro or a regular single operation - the main thing is that they all provide execute() and undo() functions.

Advanced features of the “Team” pattern

Our pattern can be used not only for processing keyboard shortcuts. It can be used to organize request queues. Let's say we have a thread pool that needs to perform some tasks. All tasks are objects that implement the already familiar Command interface. Commands are lined up in a queue, which is accessed sequentially by threads. They take commands from this queue and run their execute() methods. Threads don't care what these objects do, as long as they support calling execute(). Commands can be saved to your hard drive and restored from there. To do this, you should slightly expand their basic interface.

Command with support for saving and loading class Command ( public: void execute() = 0; void undo() = 0; void load() = 0; void store() = 0; )

The load() method is for storing the command in the log, and store() is for restoring it from there. The code for these methods may use the programming language's serialization mechanisms, if available. This functionality is needed to work with large amounts of data that cannot be saved after each action is performed on it. If the program fails, we will be able to load the saved commands and sequentially apply them to the existing copy of the data to bring this data up to date.

Conclusion

Using the “Command” pattern, we were able to completely separate the various executing modules from the client - the keyboard handler. If new modules appear in the program in the future, we can easily add the corresponding commands and assign hotkeys to them. This will be a simple, elegant and effective solution.

Using the command BREAK the object breaks at a user-defined point or points. Using commands CHAMFER (CHAMFER) And FILLET) chamfers and fillets are created

It is often easier to draw one long segment and then break it into two or more than to draw several segments. Team BREAK Most often used when creating architectural plans to break up walls at door and window openings. If you specify two points on an object, AutoCAD will erase everything in between. Typically, an object snap is used to define these points. Sometimes you can use the command for this TRIM but if you have difficulty specifying cutting edges, it is preferable to use the command BREAK.

The following AutoCAD objects can be broken: lines, polylines, splines, xlines, rays, circles, arcs and ellipses.

Using the command CHAMFER (CHAMFER) chamfers are created at the corners formed by two non-parallel segments. This command can also operate with straight lines, rays and polylines. An angle can be created by simply extending the segments until they intersect, or you can create a chamfer. If a chamfer is created, it is defined either by two legs, or by one leg and the angle of the chamfer relative to one of the edges.

The process of creating a chamfer consists of two steps. First, the chamfer parameters are set. These can be either two legs, or one leg and one chamfer angle. After entering the values, AutoCAD will complete the command CHAMFER(CHAMFER). After this, you need to run this command again and select two lines representing the edges between which the chamfer will be created. AutoCAD will create a chamfer using the information obtained in the previous step.

Team FILLET (MATES) used to construct a smooth conjugation of two segments with an arc. This operation is often used when creating mechanical drawings. In some cases the command FILLET (MATES) can be used instead of the command ARC to create arcs. Same as when using the command CHAMFER(CHAMFER), using the command FILLET(MATCHES) you can pair segments, straight lines, rays or polylines, which can also be parallel. But, in addition to these objects, circles, arcs and ellipses can also be mated. In the command to form a mating arc, you need to specify its radius

The pairing process is also two-step. First, the radius of the mating arc is determined. After this operation, AutoCAD ends the command. Now you need to start the command again FILLET (MATES) and select two mating segments. AutoCAD will pair the lines according to the available information.

Groups.


If you have a specific set of objects that it makes sense to manipulate as a group, and you are working with a fairly complex reusable selection drawing, then you can avoid repeating the tedious re-selection procedure by using the mechanism for combining objects into a group.

Creating and changing groups. To create or change a group, you need to enter in the command line group and thus open a dialog box Object Grouping(Grouping of objects).

To create a new group, follow a series of steps.

1. In the input field Group Name enter a group name. The name can be up to 31 characters without spaces. You can use a hyphen (-) and an underscore (_) anywhere in the name you enter. .

2. If desired, in the field Description You can enter a comment up to 64 characters long. You can include spaces in the comment.

3. Click the button New. AutoCAD returns to the drawing and displays a prompt at the command line Select objects: At this prompt, select the objects you want to include in the group. Finish selecting objects by clicking . AutoCAD returns the dialog box to the screen.

4. Click on OK.

Now a group has been formed to work with her further.

One object can belong to several groups.

In the zone Group identification dialog box Object Grouping there is also a button Find Name. This button is used to search for the name of the group to which the selected object belongs. AutoCAD allows you to select an object and then displays the name of the corresponding group (or groups).

Clicking a button Highlight allows you to visually highlight a given group. First from the list Group Name the group is selected, and after clicking the button Highlight AutoCAD returns to the drawing and selects all the objects in the group. After clicking the button Continue AutoCAD returns to the dialog box. Button Highlight used in cases where there is no confidence in the correct selection of a group from the list for further work.

Change Group area of ​​the dialog box Object Grouping Provides flexibility in group management. To change a group, you need to in the list of groups Group Name At the top of the dialog box, click on any group name. After this, all buttons in the zone Change Group become available. Let us describe their purpose.

Remove. If you set this option, AutoCAD switches to outputting the drawing to the graphics area of ​​the screen and displays a prompt on the command line Select objects to remove from group.... Select the objects that should be excluded from the drawing. To complete the operation, click . OK.

Add. If you set this option, AutoCAD switches to the drawing area and displays a prompt on the command line Select objects to add to group. . . (Select objects to add to the group...). Select the objects that should be added to the group. To complete the operation, press . AutoCAD will return to the dialog box. Click on OK.

Rename. When this option is specified, the group that is to be renamed is selected and in the input field Group Name her name changes. Click the button Rename. Group name in the list Group Name must also change. Click on OK.

Re-order. Each object in the group is assigned numbers, starting from 0. In some cases, the order in which objects are placed in the group matters (for example, when executing a program that operates on the objects of the group). Select the group in which the order of objects should be changed. AutoCAD will open a dialog box Order Group. If you want to arrange objects in a group in reverse order to the existing ones, click on the buttons Reverse Order. Otherwise, click on the buttons Highlight and Previous. In the lower right corner of this window

Description. This option updates the group description.

Explode. This option splits the group into its components. All objects remain in the drawing, but they cease to be a group.

Selectable. If a group is selectable, selecting one group object selects the entire group. This option allows you to temporarily switch to the mode for manipulating single objects without breaking up the group.

Attention! This is an introductory version of the lesson, the materials of which may be incomplete.

Login to the site as a student

Log in as a student to access school materials

Creating 1C configurations: adding a command

We continue to study the basics of creating configurations on 1C.

Let's return to the configurator and open the configuration tree:

Where is the processing form located?

Let's open the processing settings window "Deleting Fired Employees":

A window opened with bookmarks largely repeating the bookmarks from the “Employees” directory. This is completely normal, because the object settings in the configurator are largely similar to each other.

This time we are interested in the “Forms” tab - open it:

Find on this tab an object named “Form” - this is our visual representation of processing:

Let's open it by double clicking:

A window with many panels opened. And now it is very important for us to understand for future lessons what is responsible for what here.

Changing the code in the built-in 1C language for the form

Well, first of all, let’s pay attention to the very bottom of the window that opens. There we will find two tabs “Form” and “Module”.

The "Form" tab is a visual representation. Currently there is only one button on the form: “Delete employees”.

The "Module" tab is a code in the built-in 1C language that contains procedures and functions that determine the behavior of the form for the user.

Let's try switching to the "Module" tab:

There is only one procedure named “DeleteEmployees”. Obviously, this is what is called when the button is pressed.

The procedure code is now collapsed - click on the plus sign to expand it (it doesn’t fit in the picture on the right):

That's right, that's right. This is the place where a message appears stating that I did not write the code for this processing

Let's change this code as follows:

Let's start the 1C:Enterprise mode again (menu "Debug" -> "Start debugging"), open processing and click the "Delete employees" button:

And we will receive the same message that we just wrote:

The "Elements" tab of the form

Let's return to the configurator to our form on the "Form" tab:

Pay attention to the "Elements" tab at the top of the form. The content of this bookmark duplicates the visual representation of the form. You are reading a trial version of the lesson, full lessons are available. We can also say that everything that you see in the visual part of the form can be found on the “Elements” tab.

For example, to open the properties of the “Delete employees” button on the form, find this button on the “Elements” tab and double-click on it:

A window with the button properties will open:

Let's set the title of the button to "BANG":

The form will now look like this:

The "Details" tab of the form

Now let's move on to the "Details" tab:

This tab contains names by which we can “reach” the object data that the form represents. You are reading a trial version of the lesson, full lessons are available. So far there is only one attribute “Object” on this tab, and it’s empty.

But if we went to a similar tab in the form of the “Employees” directory, we would find here the details “Date of Birth”, “Passport Number” and “Passport Series”. This would mean that we could use them in the form module code.

The "Commands" tab for the form

The final tab we'll look at today is the "Commands" tab:

In general, all the commands that you see on one of the tabs ("Form Commands", "Standard Commands" and "Global Commands") can be safely dragged to the "Elements" tab and they will "magically" turn into buttons on the form.

As you understand, clicking on these buttons will lead to the execution of these commands.

Well, for example, let's go to the "Standard Commands" tab and drag the "Close" command to the "Elements" tab:

A close button appears on the form. Let's launch 1C:Enterprise (menu "Debug" -> "Start debugging"), open processing and make sure that the button works:


Let's return to the configurator to the processing form and go to the "Form Commands" tab:

On this tab we see the form commands that we have defined ourselves. Among other things, we can see here the command that I defined at the very beginning with the name “DeleteEmployees”.

Open the properties of this command (double-click) .

We are primarily interested in the “Action” field; click on the button with a magnifying glass next to it:

We were taken to the “DeleteEmployees” procedure in the form module. This means this command and this procedure are related. And executing the command (for example, when you click on the button it turned into) will lead to the execution of the procedure code.

Adding a new command for the form

Let's create another form command. To do this, go back to the “Form Commands” tab and click the green button with a plus:

Open its properties and set the name to “Hello”, and then click on the magnifying glass next to the “Action” field:

We are asked what kind of handler we want to create.

In general, there are two types of handlers - those that run on the client and those that run on the server. In our case, the client and server are the same computer, but this is not necessarily always the case. We will return to this conversation in future modules, but for now it is too early for us to think about it.

Select the “On Client” option and click “OK”:

We were taken to the form module in the automatically created "Hello" procedure. This procedure is now linked to the "Hello" form command:

Let's write in it the output of the line hello to the user:

But how can we now force the command (and therefore the procedure) “Hello” to be executed? To do this, return to the “Form Commands” tab and drag our “Hello” onto the form, as we did earlier with the “Close” command:

Another button has appeared on the form. Let's launch 1C:Enterprise, open processing and click on the "Hello" button. It should look like this:

Enter the user's name and say hello to him

Now let's set ourselves this task. We need the user to enter his name, we click on the button and it will display, for example, “Hello, Alexey”.

In order for us to place elements for data entry on the form, we will need a form attribute (the "Details" tab) with which this element will be associated.
Since our “Details” tab is almost empty, let’s create a new one.

Go to the “Details” tab and press the green plus button:

In the properties window of this attribute, set the name to “Name” and the type to “String”:

After this, let’s drag the “Name” attribute to the “Elements” tab in the usual way:

Aha, an element for entering a string has appeared on the form! What we needed

Let's launch 1C:Enterprise, open processing and try to enter your name there:

Everything worked out, but clicking on the “Hello” button still works as before.

We'll fix everything now. You are reading a trial version of the lesson, full lessons are available. To do this, let’s return to the configurator, go to the processing form module and find the “Hello” procedure there:

Let's rewrite it in such a way that the value of the "Name" attribute, which is associated with the input element on the form, is added to the line "Hello,"

Now let’s launch 1C:Enterprise processing again, enter your name and click the “Hello” button:

Just what you need!

Commands, elements, details, object... aren't you confused yet?

I think you are confused. I hasten to reassure you that you should not worry about this. Over time, the situation will become clearer.

In the meantime, I will try to describe to you in simpler words these components of any form. And after that you can re-read the lesson again - I’m sure a lot will become clearer.

So, a form is a visual representation of our program: buttons, labels, pictures, lists... and a lot of things! All this ELEMENTS forms.

Button - element. The inscription is an element. The input field is also an element

That is, a form element is, first of all, part of its visual representation. This means that the element has such characteristics as color, font, position on the form, size and many others.

Elements allow us to interact with the form in some way: read, click, scroll, etc.

For example.

Button

Obviously, the button cannot be on its own. When the user clicks on it, some action intended by the programmer should occur.

This action is called team

Commands can be built-in (the “Standard Commands” and “Global Commands” tabs) and those that the programmer comes up with himself (the “Form Commands” tab).

Well, built-in commands are built-in for that reason. That their action was invented before us. All we can do is drag these commands onto the form and turn them into buttons. Such commands include, for example, the command to close a form. We don't need to program anything - just drag the standard "Close" command onto the form and that's it

And the uniform team is a team invented by us ourselves. This is the command that we ourselves added to the “Form Commands” tab, then found the “Action” item in its properties, clicked on it and programmed the code in the built-in language in an automatically created handler in the form module (for example, the “Hello” command from this lesson).

Well, in general, you understand: a command is some action programmed in the 1C language (or already built into the program). A button is a visual element of a form that, when pressed, launches an associated command.

Inscription

It's just text on a form. Such an element has a “Title” property, the value of which we set in the editor and it is displayed as text.

Field

Now this is interesting. Because this is such a special element that is not on its own (like an inscription), but must be associated with some kind of data or in another way DETAILS(tab "Details").

It can be said that props is a variable form, which we declare on the “Details” tab, and the element associated with the attribute (“Field”) is its representation on the form. But the props themselves only have Name, type And meaning.

Well, imagine that we have a field on the form for entering a number. If there were no details, how would we know from the code what number the user entered? We would access the input element by name and read some of its properties, which are responsible for the value entered by the user.

So in 1C this is not possible. Here (starting with “managed” forms) the presentation of data is separated from the data itself.

It turns out that the input element is a form element. And the number that the user enters is stored not in the element itself, but in the attribute that is associated with this element.

Again. A prop is exactly data (string, number, date). Non-visual representation (inscription with text, field for entering a number, field for entering a date). The visual representation of the props is precisely the “Field” form element.

And it turns out that when writing code in the 1C language, to display and change data, we must first of all use details. We change the details from the code, and the fields associated with them on the form change automatically.

And vice versa. The user enters values ​​into the input elements (numbers, text, dates) on the form, and the details of the details also change automatically.

What advantages does this separation of form elements from data (details) provide? Big ones! The programmer creates the details he needs (for storing, displaying and entering some fields on the form) and writes program code working only with these details (data). He doesn’t think at all about how it will all look on the form. He doesn't need it! He only writes program code for now.

And only then he drags these details onto the form, the details turn into visual elements of the form, he somehow configures them, stuffs them into bookmarks and so on. In general, at this stage (visual design of the form), he works only with elements. At the same time, the likelihood of breaking already written code is greatly reduced.

Another example. Let us have an attribute "Age" with a type of "Number". This attribute stores only the number itself, nothing else. It is not responsible for what this number will look like, and in what place (or on what tab) the input element on the form associated with this number will be located. Props are just a number! Turning to the props, we will not be able to change the size of the input element on the form, color, visibility... It is not the props that are responsible for all this, but the element! By changing the details, we only change the number that is displayed in the input element on the form.

All in all: PROPS is a form variable. Therefore, we store all data in details (variables), and use elements to display them on the form (or input from the form). It is this separation of logic from presentation that allows 1C to easily display the same forms on different clients: “thick”, “thin”, “web browser”.

To access the “Age” attribute from the form module, just use its name:

What is an Object?

And finally, the object. Judging by the fact that it is on the “Details” tab, this is also a prop. That's right. But he is special.

We do not create this attribute - it appears on the “Details” tab. In the case of processing, it is empty, but if we were programming the form of some directory, then the object attribute would precisely represent the fields of this directory from the database.

A plus sign would appear next to it and we could open it and drag its individual parts onto the form and they would also turn into elements.

Take the test

Start test

1. The processing form may contain

2. The processing form is on the tab

The 1C form usually has several fields for entering data, as well as buttons for form control and various service actions. For example, for automatic filling or verification.

In order to place a button on a form, earlier, in version 8.1, you had to:

  • Drag a button to the panel
  • Add a function - buttons
  • In this function, write code in 1C language that will perform the required actions.

In order for the user to launch them, these actions have a visual representation on the form. What it will be depends on which group of form elements you drag the command into.

For example, if you simply drag it onto a form, there will be a button, if into a command panel group, then it will be a command panel button (flat), or you can drag it to a menu, then it will be a menu item.

The command can be used both on a regular form and in the managed (command) 1C interface.

Standard 1C commands

But we also know actions that do not need to be programmed in the 1C language, since they are already available in the 1C platform. For example, for directories, standard actions are the ability to create an element. For the directory form - the ability to write, and for a document - to post. Are these also actions?

Yes, and now they are called standard 1C commands. Directories, documents, forms and others have their own standard 1C commands.

Standard 1C commands can be disabled for a specific one by checking the “Use standard 1C commands” checkbox in 1C on the “1C Commands” tab.

1C team owner

1C commands are located in the sub-branch of their owner. For example, Directories/Counterparties/1C Teams.

There are also 1C teams that do not have an owner, since they are shared. Such 1C commands are not tied to objects and are located in the General/General 1C commands branch.

1C command parameters

In the configurations in reference books and documents there was a “Go” menu with which you could magically go to related 1C objects.

For example, for the Counterparties directory, the legal and physical addresses are stored in the associated Contact Data register. To go to it, you had to select the menu in the form of the counterparty(s) - Go/Contact details.

That is, for some actions, not only the fact of launching the action is required, but also a parameter that determines for which object these actions need to be performed - for example, for which counterparty to display contact information.

In the properties of the 1C command it is possible to specify:

  • 1C command parameter type – type of 1C object that will be used as a parameter, for example, the Contractors directory
  • Mode of use parameters – you need one value or a list (array).

To place a command on a form, you can specify in the 1C command properties the command interface group where it should be located.

Or simply drag the command to the list of form elements.

General commands- a platform mechanism designed to describe frequently used commands in the 1C 8.3 configuration.

General or global commands are convenient to use if one command is needed by many configuration objects. For example, a button for displaying the document subordination structure, a command for displaying document transactions, a report on object changes.

You can pass parameters to the command, for example, from the form of which object it is called.

Setting up and properties of a general command in 1C

Adding a new command and customizing the general form is quite simple; let’s look at this process in more detail:

Get 267 video lessons on 1C for free:

  • Group— location of the future command on the interface.
  • Command parameter type— defines a set of objects in which the future command will be displayed.
  • Parameter usage mode— specifies the ability to pass one or more values ​​as a command parameter.
  • Modifies data— if the checkbox is checked, then when the command is executed, the form will be recalculated from the server.
  • Command module— command execution handler, executed on the client.

Example command module:

&On the Client Procedure Command Processing(Command Parameter, Command Execution Parameters) If Value is Filled(Command Parameter) Then OpenForm( "General Form. Structure of Subordination", New Structure ("Selection Object" , Command Parameter) , Command Execution Parameters. Source, Command Execution Parameters. Source. Uniqueness Key, Command Execution Parameters. Window) ; EndIf ; End of Procedure

Here CommandParameter is the object that invokes the command. And in the Command Execution Parameters, the structure that describes the Source (the called Form), Window (ClientApplication Window), Uniqueness, indicates whether to search for an already open form or not.

1C command groups

Publications on the topic