As we already saw, every metadata object comes along with its standard set of commands we can use to open object forms and perform various actions with it. We place those commands to the Main Section or Subsystem command interface and they become available to a user in the Main Window’s Global command interface.
When a user opens a form, they see the form elements, some of which are links or buttons that run a command when clicked. They comprise the so-called local or form command interface. This is what we are here to talk about today.
Let’s open the Companies catalog item form in Designer and this is where all its commands live. All commands are split into three tabs: Form СЃommands, Standard commands, and Global commands. So, let’s start from the beginning.
Form commands are for us to add whatever additional command we need on the form. I can add any command here, then write any code I want to be executed when the command is run, drop the command anywhere on the form, and here we go.
When we dropped the command to the form elements list, the Platform created this button element whose settings I want us to play with. We can change its type right here and get the clickable link instead of the button. We use this OnlyInAllActions option to tell the form whether we want the command to be visible on the face of the form or only inside of this More actions menu. We also might want to select a picture for the button and decide if we want to see the picture only, the text only, or both. We can also mark the button as the default one, in which case it will be the first to see because of its yellowness.
So, these were the Form commands. Next up: the Standard commands.
Standard commands live on this tab and are brought over to the party by the form, its elements, and its main attribute. So, let’s check out what we have here. If I deselect the Main attribute checkbox here, the Form retains only its own commands, some of which are already present here in the drop-down menu.
Unlike the Form commands represented by form elements, the Standard commands cannot be found anywhere in the elements list. So, the Platform adds them to the Form behind the scene, without cluttering up the elements list. But what do we do if we need to change the placement or appearance of one of these guys? Well, we just create a form element as usual - by dropping the command to the elements list.
Now I can do whatever I might need with it: change its layout, replace the picture, make it all yellow and so on. And, of course, we can add to the form any command the Platform decided not to show by default. Like this form close button, for example.
By the way, what’s the deal with these mysterious guys? What do they do? They are here to help you to build simple one-question dialogs with a user. Like, for example, this one. When a user clicks one of these commands, the form gets closed and returns this DialogReturnCodesystem enumeration value for you to process. If one of the form attributes is marked as Main, it brings over all its commands to the form.
Again, there are no elements representing these commands in the list, but nothing prevents me from dropping any of them to the list and customizing them however I like. And by the way. If I don’t want any of these commands in the form, here is the place where I can disable them completely.
OK. These are the Standard commands. Last one: the Global commands
Global commands live here on the last tab and they are split into Independent and Parameterizable ones.
The Independents are nothing but our old friends from the Global command interface. These are our Quick menu commands, for example. There are also all commands included in all Subsystems. Those not included in any Subsystem end up down here in one of these additional groups. We can drop any of these guys to the form, and it will perform its command the same way it does when it’s clicked from the Global command interface.
Now, to the parameterizable commands. Remember hierarchies we discussed in Module 2? If I look at all references to the Companies catalog from other objects, this is what I will see. The Companies catalog owns the Agreements catalog meaning that a company can have any number of agreements belonging to it. This is the hierarchy the Platform is aware of so it assumes we might want to see all the agreements belonging to the company whose form we are now in. If I drop this command to the form and run the app, I will be able to see all Infinity Foods agreements just like this.
So, this is what the Form commands are about.