shawdown Posted January 10, 2018 Share Posted January 10, 2018 Hello everyone. I am initiating a chat with the UniHTMLFrame component and some doubts appeared. 1 - How do I make the vertical scroll bar go down or up completely? 2 - What better way to add text at the beginning of html? I am using the following code. UniHTMLFrame1.HTML.Text: = 'My Message <br>' + UniHTMLFrame1.HTML.Text; 3 - After adding a message at the beginning of the html how can I preserve the current position of the scroll bar? "so no matter what text size was added at the beginning of the html, UniHTMLFrame continues to display the same content it was before adding text at startup. Sorry for my bad English. And thank you all. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 11, 2018 Share Posted January 11, 2018 Hi, 1 - How do I make the vertical scroll bar go down or up completely? One possible solution, you can try to use this approach: "Up": UniHTMLFrame1.JSInterface.JSCall('body.el.dom.scrollTo', ['top', 0]); "Down": UniHTMLFrame1.JSInterface.JSCode(#1'.body.el.dom.scrollTo("top", '#1'.body.el.dom.scrollHeight);'); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 11, 2018 Share Posted January 11, 2018 2 - What better way to add text at the beginning of html? I am using the following code. UniHTMLFrame1.HTML.Text: = 'My Message <br>' + UniHTMLFrame1.HTML.Text; Also you can use this "JS" code: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniHTMLFrame1.JSInterface.JSCode('Ext.DomHelper.insertFirst(Ext.get("'#1'_id-innerCt"), {tag: "div", cls: "yourCls", html: "<b>N</b>ew line"});'); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 11, 2018 Share Posted January 11, 2018 3 - After adding a message at the beginning of the html how can I preserve the current position of the scroll bar? "so no matter what text size was added at the beginning of the html, UniHTMLFrame continues to display the same content it was before adding text at startup. Can you explain a bit more ?! Quote Link to comment Share on other sites More sharing options...
shawdown Posted January 11, 2018 Author Share Posted January 11, 2018 Hello Developer thank you very much for your attention. The problem does not happen when I use the code you entered. UniHTMLFrame1.JSInterface.JSCode('Ext.DomHelper.insertFirst(Ext.get("'#1'_id-innerCt"), {tag: "div", cls: "yourCls", html: "<b>N</b>ew line"});'); One last question. Do you think it's appropriate to use UniHTMLFrame to create a chat like the example below? What do you suggest? https://bootsnipp.com/snippets/featured/like-hangout-chat 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.