Jump to content


Photo

UniHTMLFrame


  • Please log in to reply
4 replies to this topic

#1 shawdown

shawdown

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 76 posts

Posted 10 January 2018 - 08:20 PM

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.

  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5011 posts

Posted 11 January 2018 - 06:41 AM

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

  • 0

#3 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5011 posts

Posted 11 January 2018 - 09:57 AM

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;

  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5011 posts

Posted 11 January 2018 - 10:01 AM

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


  • 0

#5 shawdown

shawdown

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 76 posts

Posted 11 January 2018 - 10:36 AM

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?
 
 

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users