AutoClick / AutoClickDelay Guide
StyledButtons can invoke OnClick event automatically, after a Delay time, activating "AutoClick" option.
Properties to activate "AutoClick" option:
- AutoClickDelay (Integer): Delay in milliseconds to "auto click" the Button (default 5000).
- AutoClick (Boolean): Start the "auto click" process (default False).
By default the AutoClick property is set to False.
When AutoClick is set to True, the button starts to "paint" itself with a "hot color". The painting process continues for a time defined in AutoClickDelay.
At the end of the AutoClickDelay time, (when the button is "full painted"), the button click itself and reset AutoClick property.
AutoClick Demo:
The demo is located in the folder:
- {StyledComponents}\Demos\StyledButtonsDemo\Delphi10.3+\AutoClickDemo.dproj
or (for older Delphi version then 10.3):
- {StyledComponents}\Demos\StyledButtonsDemo\DelphiOld\AutoClickDemo.dproj
Also the StyledTaskdialog can use this function to AutoClick and close the Dialog.
In the Demo you can see this code, to call two different versions of a Styled TaskDialog with the AutoClick option:
if cbUseCommandLinks.Checked then
DoStyledTaskMessageDlg(
'Dialog Title - use Command Links', LMessage,
TMsgDlgType.mtConfirmation,
[mbAbort, mbRetry, mbIgnore], 0, LAutoClickDelay, True)
else
DoStyledTaskMessageDlg('Dialog Title - use normal Buttons', LMessage,
TMsgDlgType.mtWarning,
[mbOK, mbCancel], 0, LAutoClickDelay, False)
If the user does not respond to the dialog box, it will close on its own!
TaskDialogDemo Demo:
Look also in the TaskDialogDemo located in the folder:
- {StyledComponents}Demos\StyledTaskDlgDemo\StyledTaskDialogDemo.dproj
Into this Demo you can see how to use the component TStyledTaskDialog to fully customize a Dialog Form, also with AutoClick/Delay option.