Jump to content

UniHTMLFrame


shawdown

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.

Link to comment
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);');
Link to comment
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;
Link to comment
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 ?!

Link to comment
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?
 
 
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...