Sections of the site
Editor's Choice:
- Outputting part of an image html sprite
- Setting up additional details and additional information for 1c nomenclature additional details and information differences
- What to do when there is no registration data
- Request for data selection (formulas) in MS EXCEL Excel selection by condition macro
- Temporary temporary one-time email Temp Email, mail sites, social media registration
- What to do if the computer does not see the phone via the USB port
- How to install Windows on Mac?
- Asus rt n16 setup firmware
- How to find out the bitness of the operating system and processor in Windows
- How to turn off the Windows Firewall: complete deactivation and disabling for individual programs How to completely disable the Windows 7 firewall
Advertising
How to programmatically fill out and open a new document form? How to open a form of an existing object? 1s 8.3 open a new document. |
Programmatically opening forms in a managed 1C application is significantly different from opening them in a regular application. Let's look at the old method first. It consists of receiving a form and then opening it in normal or modal mode (when opened in modal mode, the form blocks the program). GetForm() . Open() This is the slowest method of opening forms. However, it allows you to programmatically process the form before opening it. To process the code you need to change a little: Form = GetForm( "Document. Receipt of Goods and Services. Document Form")
;
It should be taken into account that when the form is received, another event procedure will be executed WhenCreatedOnServer. Let's look at other methods that allow you to open forms in a managed 1C application faster and more conveniently. Depending on the specific situation, different methods may be used. 1. How to open an object form in a managed application if there is a link to it.In this case, everything is extremely simple. RefLink = Directories. Nomenclature. FindByCode("000000001" ) ; 2. How to open the selection form and then get the selected value.There is a function for this EnterValue(). The function has 3 parameters:
As a result of executing the function, the default selection form for an object of the specified type will open. Variable Value; TypeDescription= new TypeDescription(Array) ; Res = EnterValue(Value, "Hint" , TypeDescription) ; Previous methods only allowed you to open the default forms for objects (object form or selection form). If you need to open a custom form, you can use the function OpenForm(). This function has quite a few parameters. Let's look at some of them:
Let's look at how the function is used OpenForm() in various situations. 3. How to open the form of an existing objectEach form has one key attribute. It is highlighted in bold in the list of form details and is usually called An object in the forms of elements of reference books and documents. Other objects may have a different name. To open a form of an existing object, you need to pass a parameter to the form being opened Key with the value as a reference to an object. &OnClient &On server 4. How to open a new object formA simple function will do here OpenForm() without any parameters. &OnClient 5. How to open a new object form and fill it out based on somethingYou need to pass a parameter Base, the value of which will be a reference to the filling base object. This will start the procedure ProcessFill(). &OnClient This example will create a document Sales of goods and services and filled out on the basis of an invoice for payment to the buyer, the link to which was transmitted. 6. How to open a form and set a selection on itSelection on 1C forms can be simple or complex. Simple selection involves expressions like Organization = Horns and Hooves LLC. Complex selection involves other types of comparison, e.g. On the list. In this article we will consider the organization of simple selection, and a separate article will be devoted to complex selection. To organize a simple selection, you need to pass a parameter with a key to the form being opened Selection, the value will be a structure in which the key is the name of the dynamic list field, and the value is the data being sought. For example, let's open the directory list form GTD numbers and make a selection there by owner - directory element Nomenclature. &OnClient Selection= new Structure; Parameter. Insert("Selection", Selection) ; OpenForm( "Directory.GTD numbers.List form", Parameter) ; 7. How to open the information register entry formTo do this, you will need the information register entry key. Record Key— these are the values of all measurements and the period (if the register is periodic). That is, a record key is the parameters by which a record can be uniquely identified. The opening algorithm is as follows:
&OnClient KeyParameters= new Structure; KeyArray = New Array; EntryKey = New( "Information RegisterRecord Key.PricesNomenclature", KeyArray) ; Parameter. Insert("Key", RecordKey) ; OpenForm( "Register of Information. Prices of Nomenclature. Record Form", Parameter) ; How to open a form of an existing object?When opening a form of an existing object, in addition to the name of the form, you must also indicate the object whose form should be opened. To do this, use the Key form parameter and a link to the object of interest to us. For example, if from the list of organizations form you need to open the form of the organization on which the cursor is located, you can do this in the following way: We pass form parameters in the form of a structure, where the name of the structure element corresponds to the name of the form parameter, and the value is the value to which we want to set the form parameter. If you want to open not the main, but an arbitrary form of an object created in the configurator, instead of the standard name of the main form (ObjectForm), indicate the word Form followed by a dot - the name of the form created in the configurator. For example: ReferenceToDirectoryElement = Elements.List.CurrentRow; FormParameters = New Structure("Key", ReferenceToDirectoryElement); OpenForm("Directory.Organizations.Form.UniversalObjectForm",FormParameters); It should be noted that in the case when, in addition to a link to an object, no parameters need to be passed to the form being opened and it is the main form of the existing object that is needed, you can use a simpler method - open the form using the procedure OpenValue(): OpenValue(Items.List.CurrentRow); This method is less versatile, but in some cases it saves time and effort. For example, in the case considered, one such line can replace the entire three-line procedure we wrote earlier. However, care must be taken when using this procedure. In some cases, it may cause additional calls to the server, for example, when you need to open a hierarchical directory item form. When using this procedure, the platform will make an additional call to the server to determine whether an element is a group or not, since different forms must be opened for the element and for the group. At the same time, this information can be known in advance to the developer within his algorithm, and, using the OpenForm() function, the developer can open the desired form without additional calls to the server, immediately specifying the standard name of the main form. |
Popular:
New
- Setting up additional details and additional information for 1c nomenclature additional details and information differences
- What to do when there is no registration data
- Request for data selection (formulas) in MS EXCEL Excel selection by condition macro
- Temporary temporary one-time email Temp Email, mail sites, social media registration
- What to do if the computer does not see the phone via the USB port
- How to install Windows on Mac?
- Asus rt n16 setup firmware
- How to find out the bitness of the operating system and processor in Windows
- How to turn off the Windows Firewall: complete deactivation and disabling for individual programs How to completely disable the Windows 7 firewall
- Powerful converter of HTML files to Doc, PDF, Excel, JPEG, Text Using the Total HTML Converter program