autoFocus property

bool autoFocus
final

When true, the picker tries to grab the focus when the picker is created.

By default the picker tries to set focus to its own widgets when it is created. It does this when either ctrlC or ctrlV are enabled in order for the keyboard listener to be able to react to copy-paste events even if no control on the widget has been focused yet.

If you need another widget to retain focus. e.g. if the picker is used on surface/scope shared with other widgets and not in its own dialog, then setting autoFocus to false might help.

If both ctrlC and ctrlV are false, the picker yields the focus the same way as setting autoFocus false, but then you have no keyboard shortcut copy-paste functions at all. With autoFocus false, you can still use keyboard copy-paste shortcuts and yield the focus from the picker. When you do this, the copy-paste keyboard shortcuts will not work until one of the picker's components have been focused by interacting with them.

The picker still grabs focus when you click on its background, as one way to set focus to keyboard listener to enable copy-paste keyboard shortcuts or when you operate any of its controls, the control in question always gains focus.

Default to true.

Implementation

final bool autoFocus;