Jump to content

FocusCancel Not Working In SweetAlert?


Frederick

Recommended Posts

I have a Confirm and a Cancel button in a SweetAlert dialogue box. However, I want to the Cancel button to be focused so that it is the default action.

The FocusCancel property seems to be the one to use but setting it to True does not cause the Cancel button to be focused. What am I missing here?

Note: This is based on the demo files of SweetAlert.

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1558)
 

Link to comment
Share on other sites

45 minutes ago, Frederick said:

The FocusCancel property seems to be the one to use but setting it to True does not cause the Cancel button to be focused. What am I missing here?

Yes, it seems the FocusCancel property is not working.

Workarounds:

1. Using the ReverseButtons property.

2. Or use this code for now:

  UniSweetAlert1.Show;
  JSInterface.JSCode('let cbtn=Ext.query(".swal2-cancel")[0]; if (cbtn) {cbtn.focus()};'); //<------

 

Link to comment
Share on other sites

6 hours ago, Sherzod said:

Yes, it seems the FocusCancel property is not working.

Workarounds:

1. Using the ReverseButtons property.

2. Or use this code for now:

  UniSweetAlert1.Show;
  JSInterface.JSCode('let cbtn=Ext.query(".swal2-cancel")[0]; if (cbtn) {cbtn.focus()};'); //<------

 

The first option switches the display order of the buttons but the Cancel button is not highlighted.

I am using the second option but the Cancel button is also not highlighted. How can I do this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...