Difference between revisions of "Cocoa Internals/Dialogs"
m (→Class Override) |
|||
Line 143: | Line 143: | ||
|No | |No | ||
| | | | ||
+ | |- | ||
+ | | - | ||
+ | |(default) | ||
+ | |canCreateDirectries. | ||
+ | |||
+ | The feature controls, if a user can create directories within the dialog. | ||
+ | |||
+ | Since Windows dialogs allows creation of folders, macOS LCL dialogs also allows the creation at all times. | ||
|} | |} | ||
Revision as of 04:21, 31 May 2020
Common Considerations
Modality
Neither of the Cocoa dialogs (OpenFile, SaveFile, Font or Color) are modal!
Meaning that one can open a dialog and keep using the other application windows and the application menu.
This doesn't work well, if the LCL design, where each dialog is opened by Execute method, which doesn't return until the modal dialog is closed.
For this particular reason, Cocoa WS does the following:
- every dialog is called as the application modal window (preventing other windows of the application from getting any user input)
- the application menu is disabled, until the dialog is closed
- where applicable add "Ok" and "Cancel" buttons are added to dialogs. Indicating a user that the dialog can be closed in order to make the selection.
No restoration
Starting with macOS 10.7 Cocoa will attempt to restore the Application windows between Launches.
It's a nice user feature, which conflicts with LCL. Since LCL adds custom controls to a dialog, and the restoration requires a special "restorationClass" to be provided.
Instead of restoring dialogs, CocoaWS explicitly forbids the restoration of them.
Class Override
Unlike NSApplication, dialog classes cannot be overwritten in the following manner:
TCocoaColorPanel.sharedPanel
Doing that will cause problems using class methods of the sharedPanel (and likely something else)
No Tags
macOS system is using "tags" on files. It seems to be a file system feature that's used commonly in macOS.
LCL doesn't have a concept of tags.
By default Save dialog is showing a user an ability to select a tag. Since LCL cannot handle it properly (it cannot return the value, nor it has APIs to save the value), the dialog hides the tag selection, by default.
File Dialog Options
Some of the options are not supported, please refer to the table below for the implementation details
Options | Supported | Description |
---|---|---|
ofReadOnly | No | |
ofOverwritePrompt | No | In macOS prior to 10.15 it was possible to implement the feature by tricking the NSSaveDialog when selecting the name.
However, this ability was removed in 10.15 (due to security considerations?) So now, overwrite prompt will always show up |
ofHideReadOnly | No | There's no concept of "readOnly" files in macOS filesystems.
There's also no configuration in the dialog, to hide files |
ofNoChangeDir | No | |
ofShowHelp | No | |
ofNoValidate | No | |
ofAllowMultiSelect | Yes | NSOpenPanel.setAllowsMultipleSelection() |
ofExtensionDifferent, | No | |
ofPathMustExist | No | |
ofFileMustExist | No | |
ofCreatePrompt | No | |
ofShareAware | No | System native dialogs are always share aware OR act within sandbox allowances |
ofNoReadOnlyReturn | No | No concept of "readonly" file |
ofNoTestFileCreate | No | |
ofNoNetworkButton | No | All shares and networks are available or restricted by SandBox limitations |
ofNoLongNames | No | Any file can have long name. OSX never suffered from 8.3 limitation |
ofOldStyleDialog | No | There's no old style on macOS
...but, there's an opportunity to use in order to allow some emulation |
ofNoDereferenceLinks | No | Links are treated by the system. |
ofNoResolveLinks | No | Links are treated by the system |
ofEnableIncludeNotify | No | |
ofEnableSizing | No | Dialogs are always sizable to the macOS rules |
ofDontAddToRecent | No | |
ofForceShowHidden | Yes | NSSaveDialog.setShowsHiddenFiles() |
ofViewDetail | No | |
ofAutoPreview | No | |
- | (default) | canCreateDirectries.
The feature controls, if a user can create directories within the dialog. Since Windows dialogs allows creation of folders, macOS LCL dialogs also allows the creation at all times. |