- Form.Modal property (Access)
- Syntax
- Remarks
- Support and feedback
- Свойство Form. Modal (Access) Form.Modal property (Access)
- Синтаксис Syntax
- Примечания Remarks
- Поддержка и обратная связь Support and feedback
- Form. Modal Свойство
- Определение
- Значение свойства
- Примеры
- Комментарии
- Can a form tell if there are any modal windows open?
- 6 Answers 6
- Not the answer you’re looking for? Browse other questions tagged c# .net winforms or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Модальные окна (modal)
- Как это устроено
- Примеры
- Модальные компоненты
- Живая демонстрация
- Статический фон
- Прокрутка длинного контента
Form.Modal property (Access)
You can use the Modal property to specify whether a form opens as a modal window. When a form opens as a modal window, you must close the window before you can move the focus to another object. Read/write Boolean.
Syntax
expression.Modal
expression A variable that represents a Form object.
Remarks
The Modal property uses the following settings.
Setting | Visual Basic | Description |
---|---|---|
Yes | True | The form or report opens as a modal window. |
No | False | (Default) The form opens as a non-modal window. |
When you open a modal window, other windows in Microsoft Access are disabled until you close the form (although you can switch to windows in other applications). To disable menus and toolbars in addition to other windows, set both the Modal and PopUp properties to Yes.
You can use the BorderStyle property to specify the kind of border a form will have. Typically, modal forms have the BorderStyle property set to Dialog.
You can use the Modal, PopUp, and BorderStyle properties to create a custom dialog box. You can set Modal to Yes, PopUp to Yes, and BorderStyle to Dialog for custom dialog boxes.
Setting the Modal property to Yes makes the form modal only when you:
- Open it in Form view from the Database window.
- Open it in Form view by using a macro or Visual Basic.
- Switch from Design view to Form view.
When the form is modal, you can’t switch to Datasheet view from Form view, although you can switch to Design view and then to Datasheet view.
The form isn’t modal in Design view or Datasheet view and also isn’t modal if you switch from Datasheet view to Form view.
You can use the Dialog setting of the WindowMode action argument of the OpenForm action to open a form with its Modal and PopUp properties set to Yes.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Свойство Form. Modal (Access) Form.Modal property (Access)
С помощью модального свойства можно указать, будет ли форма открываться в виде модального окна. You can use the Modal property to specify whether a form opens as a modal window. Когда форма открывается в виде модального окна, необходимо закрыть окно, прежде чем можно будет переместить фокус на другой объект. When a form opens as a modal window, you must close the window before you can move the focus to another object. Для чтения и записи, Boolean. Read/write Boolean.
Синтаксис Syntax
Expression. Модальное окно expression.Modal
выражение: переменная, представляющая объект Form. expression A variable that represents a Form object.
Примечания Remarks
Модальное свойство использует указанные ниже параметры. The Modal property uses the following settings.
Параметр Setting | Visual Basic Visual Basic | Описание Description |
---|---|---|
Да Yes | True True | Форма или отчет откроется в виде модального окна. The form or report opens as a modal window. |
Нет No | False False | Умолчани Форма откроется в виде немодального окна. (Default) The form opens as a non-modal window. |
Когда вы открываете модальное окно, другие окна в Microsoft Access отключаются до закрытия формы (несмотря на то, что вы можете переключиться на Windows в других приложениях). When you open a modal window, other windows in Microsoft Access are disabled until you close the form (although you can switch to windows in other applications). Чтобы отключить меню и панели инструментов в дополнение к другим окнам, задайте для свойств модальность и всплывающее окно значение Да. To disable menus and toolbars in addition to other windows, set both the Modal and PopUp properties to Yes.
Свойство BorderStyle можно использовать для указания вида границы формы. You can use the BorderStyle property to specify the kind of border a form will have. Обычно модальные формы имеют свойство BorderStyle , заданное в диалоговом окне. Typically, modal forms have the BorderStyle property set to Dialog.
Чтобы создать настраиваемое диалоговое окно, можно использовать свойства Modal, Popupи BorderStyle . You can use the Modal, PopUp, and BorderStyle properties to create a custom dialog box. Для модальных диалоговых окон можно установить для модальности значение «Да», » всплывающее окно» и » BorderStyle «. You can set Modal to Yes, PopUp to Yes, and BorderStyle to Dialog for custom dialog boxes.
Если присвоить свойству Modal значение «Да», форма является модальной только при выполнении следующих условий: Setting the Modal property to Yes makes the form modal only when you:
- Откройте окно базы данных в представлении формы. Open it in Form view from the Database window.
- Откройте его в режиме формы с помощью макроса или Visual Basic. Open it in Form view by using a macro or Visual Basic.
- Переключение из режима конструктора в режим формы. Switch from Design view to Form view.
Если форма является модальной, переход в режим таблицы в режиме формы невозможен, несмотря на то, что вы можете перейти в режим конструктора, а затем в режим таблицы. When the form is modal, you can’t switch to Datasheet view from Form view, although you can switch to Design view and then to Datasheet view.
Форма не является модальной в представлении конструктора или представлении таблицы, а также не является модальной при переключении из режима таблицы в представление формы. The form isn’t modal in Design view or Datasheet view and also isn’t modal if you switch from Datasheet view to Form view.
Вы можете использовать параметр Dialog диалогового окна макрокоманды виндовмоде для открытия формы, свойству модальных и всплывающих окон которых присвоено значение «Да». You can use the Dialog setting of the WindowMode action argument of the OpenForm action to open a form with its Modal and PopUp properties set to Yes.
Поддержка и обратная связь Support and feedback
Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Have questions or feedback about Office VBA or this documentation? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь. Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Form. Modal Свойство
Определение
Возвращает значение, указывающее, отображается ли форма как модальная. Gets a value indicating whether this form is displayed modally.
Значение свойства
Значение true , если форма отображается как модальная; в противном случае — false . true if the form is displayed modally; otherwise, false .
Примеры
В следующем примере свойство используется Modal для определения, отображается ли форма как модальная форма. The following example uses the Modal property to determine if a form is displayed as a modal form. Если это не так, FormBorderStyle TopLevel Свойства и изменяются, чтобы форма стала формой не верхнего уровня с границей окна инструментов. If it is not the FormBorderStyle and TopLevel properties are changed to make the form a non-top-level form with a tool window border.
Комментарии
При отображении формы в модальном режиме входные данные (нажатие клавиши или мыши) не могут быть выполнены, за исключением объектов в модальной форме. When a form is displayed modally, no input (keyboard or mouse click) can occur except to objects on the modal form. Программа должна скрывать или закрывать модальную форму (обычно в ответ на какое-либо действие пользователя), прежде чем может произойти ввод в другую форму. The program must hide or close a modal form (usually in response to some user action) before input to another form can occur. Формы, которые отображаются модально, обычно используются в качестве диалоговых окон в приложении. Forms that are displayed modally are typically used as dialog boxes in an application.
С помощью этого свойства можно определить, отображается ли форма, полученная из метода или свойства, модальной. You can use this property to determine whether a form that you have obtained from a method or property has been displayed modally.
Чтобы отобразить форму в модальном режиме, используйте ShowDialog метод. To display a form modally use the ShowDialog method.
Can a form tell if there are any modal windows open?
How, being inside the main form of my WinForm app can I tell if there are any modal windows/dialogs open that belong to the main form?
6 Answers 6
Long story short: opening a modal form is blocks execution on the main form as long as the modal window is open, so your main form can never check to see if its opened any modal forms until after the modal form has closed. In other words, your question is based on a misunderstanding of how modal forms work, so its moot altogether.
For what its worth, it is possible to tell if there are any modal forms open:
You maybe can use the events for EnterThreadModal and LeaveThreadModal . Here is an example how you can do it:
This is an illustration why this answer is correct and the assumptions made in this answer are sometimes wrong.
This works for modal shown sub Forms and for MessageBoxes.
If you Google a bit you will find that Form.ShowDialog() disables other forms to prevent user input to those forms of the current one. But most everything else (like timers and other events from sources external to the displayed form) continues to run.
Timers still run and fire events.
Example that works.
Not the answer you’re looking for? Browse other questions tagged c# .net winforms or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Модальные окна (modal)
Используйте модальный плагин Bootstrap для JavaScript, чтобы добавить на свой сайт диалоговые окна для лайтбоксов, уведомлений пользователей или полностью настраиваемого контента.
Как это устроено
Прежде чем приступить к работе с модальным компонентом Bootstrap, обязательно прочтите следующее, поскольку параметры нашего меню недавно изменились.
- Модальные окна создаются с помощью HTML, CSS и JavaScript. Они располагаются поверх всего остального в документе и убирают прокрутку, , чтобы вместо этого прокручивалось модальное содержимое.
- Щелчок по модальному «фону» автоматически закроет модальное окно.
- Bootstrap поддерживает только одно модальное окно за раз. Вложенные модальные окна не поддерживаются, так как мы считаем, что они неудобны для пользователей.
- Использование модальных окон position: fixed , которые иногда могут быть немного специфичными в отношении рендеринга. По возможности размещайте модальный HTML-код на верхнем уровне, чтобы избежать потенциального вмешательства со стороны других элементов. Скорее всего, вы столкнетесь с проблемами при вложении .modal в другой фиксированный элемент.
- Еще раз, из-за того position: fixed , что есть некоторые предостережения при использовании модальных окон на мобильных устройствах. См. дополнительную информацию в документации по поддержке браузера .
- Благодаря тому , как HTML5 определяет его семантику, атрибут HTML не имеет никакого эффекта в Bootstrap модальностей. Чтобы добиться того же эффекта, используйте собственный JavaScript: autofocus
Продолжайте читать, чтобы увидеть демонстрации и инструкции по использованию.
Примеры
Модальные компоненты
Ниже приведен статический модальный пример (то есть его position и display были переопределены). Включены модальный заголовок, модальное тело (требуется для padding ) и модальный нижний колонтитул (необязательно). Мы просим вас по возможности включать модальные заголовки с действиями по отклонению или предоставить другое явное действие по отклонению.
Modal title
Modal body text goes here.
Живая демонстрация
Переключите рабочую модальную демонстрацию, нажав кнопку ниже. Он будет скользить вниз и исчезать из верхней части страницы.
Modal title
Woohoo, you’re reading this text in a modal!
Статический фон
Если фон установлен на статический, модальное окно не закроется при нажатии вне его. Нажмите кнопку ниже, чтобы попробовать.
Modal title
I will not close if you click outside me. Don’t even try to press escape key.
Прокрутка длинного контента
Когда модальные окна становятся слишком длинными для области просмотра или устройства пользователя, они прокручиваются независимо от самой страницы. Попробуйте демонстрацию ниже, чтобы понять, что мы имеем в виду.
Modal title
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Вы также можете создать прокручиваемое модальное окно, которое позволяет прокручивать модальное тело путем добавления .modal-dialog-scrollable в .modal-dialog .
Modal title
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.