Hardware and software setup

1c allow modal windows in a managed application. Why does the error "The use of modal windows in this mode is prohibited" occur? Rejection of modality

The Syntax Help for these commands states that if the configuration property ModeUseModality installed in Do not use, then other commands should be used in the program code, such as ShowQuestion(), ShowWarning(), ShowInputNumbers():

To work with these situations, the 1C 8.3 program provides a new system object "Notification Description", which is used to describe the call of the program module procedure when an expected event occurs, such as closing a form or modeless dialog:

This is a look at the problem "from the inside" for those who want to deal with the root cause. First of all, for 1C programmers. How in this situation ordinary users fix the error without working out program code? There is a very simple method.

Instructions for fixing the error for ordinary users

Step 1. Finish the job:

Step 2. We return to the start menu to start the configuration. Select the "Configuration" menu item:

Step 3. Open the "Configurator": on top panel find the "Configuration" button, and in the proposed list select the "Open configuration" menu:

Step 4. Place the cursor on the Configuration and right-click to call context menu, in which we select the "Properties" item:

Step 5. Open the "Properties" form:

Step 6. Find the line “Modality using modality” (at the bottom of the list):

By default, the 1C 8.3 program is set to "Do not use". We translate the value "Do not use" to the value "Use":

Result:

If the error "Using modal windows v this mode forbidden" in 1C 8.3 is gone, then you can work further. Usually, this is what happens.

But if the modality error in 1C remains after performing all these steps, then you should contact the programmers who maintain and support your 1C program.

How to work in the “Taxi” interface, how to customize the workplace “for yourself”, setting up the navigation bar Favorites, how to perform full-text search, techniques for working with magazines, the “select” button in documents, transferring links to documents, verification and other features in new interface - all this can be found in our video:

In more detail about how to correctly and quickly organize navigation through the 1C 8.3 program using new interface TAXI, about new opportunities in using familiar tools, such as a built-in calculator, calendar, file comparison, transferring links to documents to colleagues, are considered in our course ““


Rate this article:

In the 1C platform version 8.3, a new mode of program operation has appeared - without the use of modality. More precisely, 2 new modes appeared: without using modality and using modality, but with a warning. And the old mode of operation is indicated as using the modality.

What does it all mean? V early versions platform, we used various modal windows and did not really think about it. For example, you need to display a warning to the user or you need to ask a question or enter some value or select a file. These are all modal windows.

What does modal mean? This means that when this window is called, it overlaps all other windows, that is, it is displayed at the very top and blocks work with other windows until the work with this window is completed. In addition to blocking windows, code execution stops exactly at the place where this window is called, and code execution continues only after closing such a window. From where the execution stopped. I will illustrate the call of the modal window using the example of calling the period selection form:

&AtClient

StandardProcessing = False;




If Dialog.Edit() Then //Call the modal form. Code execution will continue only after the form is closed.
Elements.Services.CurrentData.StartDate = Dialog.Period.StartDate;
Elements.Services.CurrentData.EndDate = Dialog.Period.EndDate;
EndIf;

EndProcedure


As we can see, one procedure is enough to process the call of the modal period selection window.

Why are modals bad? Now let's figure out why 1C decided to stop using modal windows. Well, first of all, this is a consequence of the fact that the 1C platform can be used not only in its usual form - as a desktop application, but can also be launched in a browser and can be launched as a mobile application.

The problem is with browsers. The modality of windows in them is implemented using pop-up individual browser windows. They are supported by almost all browsers, but due to the frequent use of such windows for advertising, almost all browser developers struggle with them and disable the ability to use such windows by default. As a result, in order to enable the 1s user to work in the browser, you have to force him to allow these windows, devote to all the intricacies of 1s and browsers, and generally overload with unnecessary information.

A separate nuance with browsers for tablet computers and browsers for phones. In most cases, these browsers do not support pop-ups. The interfaces (monitors and input devices) of such pop-up devices are not compatible.

And finally mobile app 1C is also not quite friendly with modal windows.

Hence the conclusion: do not use modal windows. And what to use instead of them? Instead, you need to use the same windows, but without the modality mode. In the new platform, 1C also developed such a mode for each window. It is implemented as a separate method for each dialog. This mode allows you to call the window, but not stop the execution of the program code. Technically, in browsers, this is implemented as a pseudo window that appears inside the parent window, but overlaps it. The fact that the code continues to be executed after the window is opened means that you will not be able to get the values ​​selected in it right after the window call code. They haven't been chosen yet. Therefore, the receipt and processing of these values ​​is carried out in a separate procedure, which is called when such a window is closed, and this procedure is specified when calling the window opening method. Let's look at the example of the same period selection window.

&AtClient
Service ProcedureStartDateSelectionStart(Item, ChoiceData, StandardProcessing)

StandardProcessing = False;

Dialog = New DialogEditStandardPeriod();
StandardPeriod = New StandardPeriod();

StartDate = Items.Services.CurrentData.StartDate;
EndDate = Items.Services.CurrentData.EndDate;

StandardPeriod.StartDate = StartDate;
StandardPeriod.EndDate = EndDate;
Dialog.Period = StandardPeriod;

AlertDescription = New AlertDescription("ProcessingPeriodSelect",ThisForm);

Dialog.Show(DescriptionAlerts)

EndProcedure

&AtClient
Procedure ProcessingPeriodSelect(Period,Parameters) Export

If Period<>Undefined Then

Items.Services.CurrentData.StartDate = Period.StartDate;
Items.Services.CurrentData.EndDate = Period.EndDate;

EndIf;

EndProcedure


As we can see, Show() is called instead of Edit(). And handling of a choice event already in other procedure.

So, we figured out how to do without modality. Now let's figure out why we need the mode of using a modality with a warning. In fact, this is such a transitional mode. When you have not yet managed to remake your entire configuration into a mode without using a modality, but are already striving for it. And every time you call a modal window, the program will give you a warning that in this mode it is undesirable to call modal windows.

Well, we are abandoning modality and mastering new technologies for 1C work in browsers and mobile computers.

Dialog boxes, which we are quite used to when working with various systems and, in particular, in 1C, can appear when performing various actions, require the user to enter any data, for example, a specific value, select a file, answer a question, or simply issue warning. They are also called modal.

Without a response to the request of such a window, it is impossible to continue working in the program. The window blocks the interface, blocks the work of other windows, and at the same time, the execution of the program codes will also stall at the place where the dialog was called - the program is waiting for the completion of the action with it.

Dialogs usually do not cause problems in thin and thick client launch mode, but problems can occur when working with the web client. This is due to the fact that the same system elements on the Internet are used as advertising media, and users often turn off their display in the browser settings. Accordingly, their work is also blocked in a program running through a web browser. Therefore, working with 1C through a web client or on mobile platform, we must not forget to perform additional setting browser and remember that mobile browser does not support popup messages at all.

How to fix an error in 1C: "The use of modal windows in this mode is prohibited"

Such an error began to appear after the transition of 1C to the new interface of the 1C 8.3 platform - Taxi. This is due to the fact that the developers included working with windows, but without the modality mode.

Fig.1

Let's open information base in the "Configurator" mode and see the properties of our configuration by clicking right click mouse and select "Properties". Scrolling the line below, we see the "Compatibility" section, where the mode parameter of interest to us is located and the options are listed - "Use / Use with warning / Do not use."



Fig.2

After that, you need to save and update the changes in the configuration. The error we are talking about appears when there is a checkbox to not use the modality mode. This feature has been available since platform 8.3.3.721, released in September 2013. That is, users working on older versions of the platform do not need to opt out of the modality. In other versions, so that the error window does not appear, you can simply set it to “Use”.

In our example, the warning option is set. Of course, in the future, developers will finalize the configuration to use other functions bypassing modal windows. But today, the mode from our example is just used by the developer during the transition, when not all the configuration has yet been redone to the modeless mode. Therefore, the program will also issue messages about the prohibition of windows with modal characteristics.



Fig.3

Applications that are used through the web client, on the iPad, in the cloud, for example, on "1cfresh.com", do not use this mode. All new configurations use the modal mode of the interface.

Rejection of modality

The developers of the 1C program, supporting global trends, are trying to bring the program interface closer to web samples and bring it to a single standard, thereby giving users the opportunity to work in the same window with the usual "external".

Therefore (and in order to remove the problems described above), it was decided to eliminate pop-up dialogs without limiting the functionality of the solutions. At the same time, messages in the new mode of program operation appear within the parent window, and not, as before, in the modal window. Although it still blocks the entire interface.

That is, the innovation saves us from the need for additional browser settings, stabilizes the web client and improves its performance. Also, since there is no longer a need to open pop-up windows, any configuration with these changes can be used on any device.

If in the process of doing the lessons you have such an error, it is very easy to fix it.

Return to the configurator and select the menu item "Configuration" -> "Open configuration":

In the window that opens, right-click on the "Configuration" item and select the "Properties" item from the drop-down menu:

A window with configuration properties will open (on the right):

Scroll to the very bottom and find the item "Modality use mode" there:

Set its value to "Use":

Attention! Please note that if you are using a 1C platform other than the one we downloaded in the first lesson (a later version), then you will also have the "Synchronous calls usage mode..." field. It also needs to be set to "Use".

Finally, select the menu item "Configuration" -> "Save configuration":

Ready! Now the error will no longer occur.

Explanations below - for those who are interested in what we did.

We have enabled the modality mode in our configuration. By default, this mode is disabled and it does not allow us to use commands such as EnterNumber, EnterString, EnterDate, OpenValue.

The fact is that these commands are modal. Their call leads to the fact that a window appears in front of the user (for example, for entering information), which blocks the ability to work with the program until the window closes.

And since the presence of such windows is highly undesirable when working with 1C through a web browser, when developing new configurations, the modality mode is turned off by default.

We can safely include it, as we write training examples that are not designed to work on the Internet.

15
The following switches are used to force the start of an enterprise in a Regular or Managed application: /RunModeOrdinaryApplication starts a thick client in normal mode, regardless of the configuration settings and the user on behalf of which 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 from the root configuration element in the access rights. The panel settings and the menu item will be disabled. 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 further work using windows or 2
In the last article: Installing the 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 explain how to load the Address Classifier (KLADR) in the managed interface and 2
Often, when developing a certain configuration, users want to attach photos to an element of the directory and have them stored in the database. In this article I will tell you how to connect a photo storage in the form of a reference book to the reference book of construction objects.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!