Almodovar Posted October 22, 2015 Share Posted October 22, 2015 Hi I trying to set focus on TUniHTMLMemo's text, but using the component SetFocus procedure fail. How I can do it? Thanks in advance Link to comment Share on other sites More sharing options...
Sherzod Posted October 22, 2015 Share Posted October 22, 2015 Hi, One of the possible solution, while, try: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('Ext.get("'+ UniHTMLMemo1.JSName +'_id-inputCmp-iframeEl").focus()'); end; Best regards. 1 Link to comment Share on other sites More sharing options...
Almodovar Posted November 12, 2015 Author Share Posted November 12, 2015 Thanks a lot!!! Link to comment Share on other sites More sharing options...
shawdown Posted January 14, 2018 Share Posted January 14, 2018 Hi, One of the possible solution, while, try: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('Ext.get("'+ UniHTMLMemo1.JSName +'_id-inputCmp-iframeEl").focus()'); end; Best regards. This code is not working in my project. It does not display any errors but the focus is not set. I am using version 1.0.0.1422. Any suggestion? Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 Hi, Ok, I will check Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 I couldn't reproduce, can you make a simple testcase for this or provide part of your code here ? Link to comment Share on other sites More sharing options...
shawdown Posted January 14, 2018 Share Posted January 14, 2018 A simple example is attached. 1º - Click Button "Edit Focus" 2º - Click Button "HTMLMemo Focus" 3º - Click again in Button "Edit Focus" 4º - Click again in Button "HTMLMemo Focus" and now have problem. This example running in http://192.99.198.144:8077/ Thanks friend. focus.zip Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 Hi, Thanks for the testcase, Online demo example works for me. Which browser are you using ?! Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 Or, try with Ext.defer fn: UniSession.AddJS('Ext.defer(function(){Ext.get("'+ UniHTMLMemo1.JSName +'_id-inputCmp-iframeEl").focus()},100)'); Link to comment Share on other sites More sharing options...
shawdown Posted January 14, 2018 Share Posted January 14, 2018 Hi, Thanks for the testcase, Online demo example works for me. Which browser are you using ?! I'm using "Google Chrome Version 63.0.3239.132 (Official Version) 64-bit (Last Update)" In Internet Explorer 11 there is also a problem. The problem continues even with the code being reported. UniSession.AddJS('Ext.defer(function(){Ext.get("'+ UniHTMLMemo1.JSName +'_id-inputCmp-iframeEl").focus()},100)'); In firefox it works perfectly. Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 I will check this behavior Link to comment Share on other sites More sharing options...
Sherzod Posted January 14, 2018 Share Posted January 14, 2018 Can you try this approach ?!: UniHTMLMemo1.JSInterface.JSCall('focus', []); Link to comment Share on other sites More sharing options...
shawdown Posted January 14, 2018 Share Posted January 14, 2018 Can you try this approach ?!: UniHTMLMemo1.JSInterface.JSCall('focus', []); Internet Explorer 11 and Firefox are working perfectly. But in Google Chrome the problem continues. Link to comment Share on other sites More sharing options...
shawdown Posted January 15, 2018 Share Posted January 15, 2018 Any suggestion? Link to comment Share on other sites More sharing options...
Sherzod Posted January 16, 2018 Share Posted January 16, 2018 Hi, Any suggestion? Ok, can you try to use this approach for now ?!: //UniHTMLMemo1.JSInterface.JSCall('focus', []); UniHTMLMemo1.JSInterface.JSCode('if (Ext.isChrome) {'#1'.iframeEl.el.dom.contentDocument.body.focus()} else {'#1'.focus()};'); Best regards, Link to comment Share on other sites More sharing options...
shawdown Posted January 16, 2018 Share Posted January 16, 2018 Hi, Ok, can you try to use this approach for now ?!: //UniHTMLMemo1.JSInterface.JSCall('focus', []); UniHTMLMemo1.JSInterface.JSCode('if (Ext.isChrome) {'#1'.iframeEl.el.dom.contentDocument.body.focus()} else {'#1'.focus()};'); Best regards, Perfect. Thank you very much for your attention. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now