Internet Windows Android

How to remove modal windows in 1s. Why is the error "The use of modal windows in this mode is prohibited" occurs? Quick fix for the problem

14
To force the enterprise to start in a Normal or Managed application, the following keys are used: / RunModeOrdinaryApplication starts the thick client in normal mode, despite the configuration settings and ... 3
It is necessary that users cannot change the interface configured for them! Solution: To disable it, you need to remove the "Save user data" right in the access rights of the root configuration element. ... 2
In the current work, the user usually opens several objects. It can be a document, reference book, report, etc. In the previous interface, there were no problems quickly finding an open object and updating it for ... 2
In the last article: Installing an address classifier (KLADR) in 1C, I told you what Kladr is and how to load it into 1C regular forms (8.0-8.2). In this article I will show you how to load the Address Classifier (KLADR) in ... 2
Often, when developing a certain configuration, users want to attach photos to an element of the directory and so that they are stored in the database. In this article I will tell you how to connect construction objects to the reference book ...

The introduction of a new interface of the 1C 8.3 platform - "taxi" - led to the fact that users and programmers encountered an error of the following content: modal windows v this mode forbidden".
Rice. 1

The developers of the 1C technological platform strive to succeed in the global trends by bringing software in accordance with international standards. The latter inevitably leads to a unified interface close to web pages.

Modal and pop-up windows, being a sign of bad taste, have long been recognized as unacceptable in software development. The need to work "in one window" is firmly rooted in the minds of users.

The developers of the 1C platform have made an attempt to introduce the developers of applied solutions to work in a "new way". With the introduction of the new taxi interface, they complemented the new platform new function- "mode of using modality".

Quick fix for the problem

In the absence of time, if you need to quickly solve the problem, you can resort to a fairly simple, but not too correct solution - you just need to change the modality mode in the configuration properties.

To this end, go to the system in the configurator mode, open the configuration:

After that, right-click on the configuration root to open context menu, select "Properties":


Rice. 3

In the opened configuration properties, in the tabs, find "Modality use mode", in it select "Use":


Rice. 4

Save and apply the changes by pressing the "F7" key.

Implemented in version 8.3.3.641.

1C: Enterprise uses modal windows in situations when the user is required to enter information, without which further execution of the algorithm is impossible. In this case, the entire rest of the program interface is completely blocked, and the execution of the program code stops until the user closes the modal window.

With the advent of the web client and the transition of 1C: Enterprise to mobile platforms, modals turned out to be the source a large number inconveniences and problems, often unsolvable.

Typically, "desktop" browsers are better or worse, but they support modal windows and open them in a new browser window as a "popup":

But due to the fact that pop-up technology is widely used on the Internet for advertising, pop-ups are disabled by default in almost all browsers. In the overwhelming majority of cases, without changing this browser setting, the operation of the web client becomes impossible.

Another problem is that mobile browsers do not support modals at all. And so that 1C: Enterprise could work in them, a special mechanism was implemented in the web client. This is a rather complicated mechanism and, unfortunately, it does not cover all the necessary situations. As a result, configurations work on iPad, for example, with great difficulty.

In such a situation, the option of the 1C: Enterprise interface without using modal windows removes all the problems listed above.

This does not abandon the functionality that was previously provided by modal windows. But this functionality is implemented by other technologies that do not interfere with the operation of 1C: Enterprise in browsers.

In the new interface mode, the window, which would have been modal before, is drawn within the parent window, and in the same way blocks the rest of the web client interface:

As a result:

  • no new browser windows are opened, which improves the performance and stability of the web client;
  • In many cases additional customization the browser becomes unnecessary, since 1C: Enterprise no longer uses pop-up windows;
  • any configuration using the web client can work on iPad and other mobile devices.

Naturally, miracles do not happen, and the new operating mode cannot be switched on with a "wave of a magic wand". It is required to change the logic of working with new blocking windows. But the good news is that these changes are not difficult, and it is possible to control all the "suspicious" parts of the program. The platform implements a special mechanism that allows at the development stage to check that the entire configuration uses new mechanisms and will work without modal windows.

The need to change the logic of working with such windows is due to the fact that the new interface operation mode provides modality only for the user. However, for the developer, at the moment the blocking window is displayed, the execution of the program code does not stop.

This means that the algorithm, which used to be one whole, now has to be divided into two parts. One, which ends with the opening of a blocking window, and the second, which will be executed when the user closes this window. In order for the system to know where to continue executing the program code, the name of the procedure that must be executed when the user closes this window is passed to the blocking window.

The essence of these changes is easiest to see with an example. An old procedure that opened a modal window and processed the data it received might look like this:

In the new version for the form FormText Input (which will open in a blocking window) you need to set the property WindowOpen Mode in value BlockAllInterface ... This will provide modality to the user:

And the program code instead of one procedure, as before, will already contain two procedures:

In the first procedure, open the form. In this case, in the last parameter, we pass it the location of the second procedure, which will be executed after the user closes the window. In this case, this procedure is located in the same module, but in general it can be located in another.

When the user enters data and closes the form, they will be processed in the second procedure we specified, into which we simply transferred the "old" code that processes the received data.

In addition to forms that a developer can open in modal mode (at will), there are embedded language methods that always, regardless of the developer's wishes, open modal forms for entering or selecting data. For example, the method Enter Value () .

It is even easier to use such methods in non-modal mode. For all such methods, the platform has made backup methods, when calling them, you also need to indicate the location of the procedure that will be executed after the user closes the window.

For example, below shows the use of the old method Enter Value () and his new backup method ShowEnterValues ​​() :

I must say that, in addition to the listed cases, some platform mechanisms also use modal windows to interact with the user. And this does not depend in any way on the actions of the developer.

Therefore, all such system dialogs of the platform are also transferred to a non-modal version of the work.

It is planned to gradually abandon the use of modal windows in applied solutions. Therefore, for compatibility with the applied solutions written earlier, the platform retains the ability to work in the old version of the interface, using modal windows.

In the configuration properties on the 1C: Enterprise 8.3 platform, there is a Mode for using modality. If the value of this field is "Do not use", then when you try to open a modal window, the platform will display the message "The use of modal windows in this mode is prohibited." This stops the execution of the program code.

This article shows the mechanism for changing the program code, using an example of a question to the user when the modal mode is disabled.

From time to time, when developing a software product, there is a need to ask the user about the actions to be performed. For example, with automatic filling tabular sections... When, before refilling the PM, it is necessary to ask the user about the need to do this. And depending on his response, the PM will be cleared and refilled or not.

The part of the code with the question might look something like this:

If PM. Quantity()< >0 Then Answer = Question (" // This line will display a modal window with a question and the code execution will stop until the user answers If Answer = Dialog Return Code. No Then Refund; EndIf; // User agreed to continue PM. Clear (); EndIf; // Take further action // The program will get here if the PM was empty or the user answered positively to the question about overfilling Performing FurtherActions ();

If the modal mode is disabled, an error will occur in the line with the question of this code and further execution will be interrupted. This is because the Question function uses a modal window.

In this situation, you must use the ShowQuestion procedure. When using this procedure, the user is not expected to complete a response. However, the first parameter of this procedure is the description of the alert that tracks the user's response.

How the earlier written code will change:

// It is necessary to fill the PM with data // Check the PM for fullness If PM. Quantity()< >0 Then // PM is not empty, you need to ask the user about overflow ShowQuestion (New DescriptionAlert (" OverflowPTCompletion", ThisObject, AdditionalParameters)," The PM will be overfilled. Proceed ?", Dialogue ModeQuestion. Yes No); // This line will display a window with a question, but the execution of the code will not stop Otherwise // The program will get here if the PM was empty PerformFurtherActions (); EndIf; // The program will get here in any case, whether the PM was empty or not // (unless, of course, there was no error in the previous code) . . . // Export procedure in the same module // Called after the user answers the question& OnClient Procedure OverflowPOFCompletion (ResponseResult, AdditionalParameters) Export If ResponseResult = DialogReturnCode. No Then // User refused to continue Return ; EndIf; // Perform further actions // The program will get here if the PM was not empty and the user answered positively to the question about overfilling PM. Clear (); PerformFurtherActions (); End of Procedure

Thus, since the program will not stop when the ShowQuestion procedure is executed, all events must be carefully handled.
When solving this problem, the execution of further actions can occur in two events:
1. If PM was empty
2. If the PM was not empty and the user responded positively to the overflow question

And, accordingly, since the program does not stop waiting for the user's response, the call of these events has to be distributed to different parts of the code.
Therefore, as a rule, all performed methods that need to be performed after checking the PM for fullness are placed in a separate procedure.

A similar mechanism is used for similar user interaction functions (SelectValue, SelectFrom List, etc.)

"The use of modal windows in this mode is prohibited" - this error now begins to bother 1C users and programmers with the arrival of the new interface of the 1C 8.3 platform - "".

The developers of the 1C technological platform keep up with the times, standardizing their solution to world standards of software development. All standards in one way or another are reduced to a single interface, close to web pages.

Modal and pop-up windows are considered bad form and have long ceased to be normal in software development. Users are accustomed to working "in one window".

Especially often we see a modality error in following methods 1C:

  • Question;
  • A warning;
  • OpenValue.

With the release of the new taxi interface, the developers of the 1C 8 platform made the right decision - to try to retrain the developers of applied solutions in a new way. They have included in the new platform a feature called "modality mode".

Quick fix for the problem

If there is no time to figure it out and you need to quickly solve a problem, we offer a simple, but not entirely correct solution. To quickly fix the error, it is enough to change the modality mode in the configuration properties.

To do this, go to the system in the mode, open the configuration:

In the open configuration, call the context menu by right-clicking on the configuration root and selecting "Properties":

Get 267 1C video tutorials for free:

The configuration properties will open, where in the basement there is a property of interest to us - "Modality use mode", select the "Use" mode:

After that, save and apply the changes by pressing the "F7" key.

The correct solution to the problem

The correct way to solve this problem is to modify the configuration or external processing for new requirements.

Warning, question, dialog boxes and other modals - all this needs to be rewritten in a new way.

The built-in operators that called modals need to be replaced with duplicate functions.

For example:

  • Warning - Show Warning;
  • Question - Show Question (in detail -);
  • - Show Input Numbers.

At the same time, a specialized object appeared - Notification Description.

Replacement example:

String = ""; EnterString (String, "Enter string value") Report ("You entered" + String);

Must be replaced with:

String = ""; Alert Description = New Alert Description ( "TestInputString", ThisForm); ShowInputString (Alert Description, String, "Enter string value") ;

At the same time, add a similar procedure on the client, which will work when the value is entered by the user:

& OnClient Procedure TestInputString (ReceivedValue, PassedParameters) Export Report ("you entered" + String); End of Procedure

Forms that are developed inside the configuration open in the same way. It is enough to replace the "OpenFormModal" method with "OpenForm", specifying the description of the notification and the new procedure required for it.

To close access to the called form by the opening form, it is enough to specify in the "WindowOpening Mode" property the "Lock owner window" value in the form property: