Jump to content

How I can focus a TUniHTMLMemo text?


Almodovar

Recommended Posts

  • 3 weeks later...
  • 2 years later...

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

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

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

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.
  • Like 1
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...