Why is a modal/modeless dialog called modal/modeless?
I always have trouble remembering whether the modal or modeless dialog is the one blocking operations in other parts of the application.
Does anyone know why they are calle开发者_运维技巧d that way?
With a modal dialog, you set your application in a particular mode (a different "state" if you will), whereby only actions pertaining to that "mode" are accepted, hence preventing UI actions outside of the dialog.
At Andreas' prompting I thought I may have to dig dusty Windows API books, as often, the etymology/origin of a word or expression that has became broadly accepted is only found in early documentation, but in fact we still see this referenced in an online glossary from MS. The Modal entry reads (emphasis is mine):
modal
Restrictive or limited interaction due to operating in a mode. Modal often describes a secondary window that restricts a user's interaction with the owner window. See also: modeless.
A modal system is one with multiple "modes of operation". Such a system switches between modes by using key strokes, for example "Esc" "CTRL+S". A good example is the Vim text editor which switches between "edit text mode" and "navigate text mode".
A modal dialog is thus one which blocks the main program by switching it to a different mode for the duration of the operation.
I believe this is a tip to Linguistic Modality. "Modal" dialogs are used (typically) to present information that falls into the typical modals of:
- Declarative
- Interrogative
- Exclamatory
Part of why I feel this is the case, although I'm searching for a more definitive answer, is the way modal dialogs are discussed. For example, take MSDN - their criteria is "Dialog boxes that display important messages should always be modal.", which could easily be rewritten as "Dialog boxes whose content is of a declarative modal [linguistic definition of modal here] should be created as Modal windows."
There is other precident for this. For example, the word "dialog" in dialog box - it's called a "Dialog box" because it's supposed to be presenting a dialog, or conversation, between the system and user - another throwback to linguistic terminology for a computational process.
Looks like the only reason is that it is related to modes and mode errors.
精彩评论