Frederick Posted March 7, 2022 Share Posted March 7, 2022 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) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 7, 2022 Share Posted March 7, 2022 Hello, We will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 7, 2022 Share Posted March 7, 2022 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()};'); //<------ Quote Link to comment Share on other sites More sharing options...
Frederick Posted March 7, 2022 Author Share Posted March 7, 2022 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? sweetalertdefbtn.mp4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.