Jump to content
uniGUI Discussion Forums
shawdown

UniHTMLFrame

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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);');

Share this post


Link to post
Share on other sites

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;

Share this post


Link to post
Share on other sites

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 ?!

Share this post


Link to post
Share on other sites
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?
 
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×