HtmlEditor :  Phorum 5 The fastest message board... ever.

This is the discussion forum for the HtmlEditor. See also the HtmlEditor home page, where you can download the control, and the Documentation Wiki, a collaborative project for documenting the control.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
m_htmldoc.body doesnot refresh with LoadDocument()
Posted by: Atara Halamish (---.bb.netvision.net.il)
Date: Thursday, 30-Oct-2003, 14:38:11

I would like to use this control because it is much better than using microsoft mshtml.

In my application I dynamically change the doc, using -
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<html><head>");
sb.Append("<STYLE TYPE='text/css'> ... </STYLE>");
sb.Append("</head>");
sb.Append("<BODY id='imcBODY' scrolls='no' border='0px' >");
sb.Append("<TABLE id='imcTable' cellspacing='0' cellpadding='2' cols='1' width='100%' border='0'>");
...
sb.Append("</body></html>");
this.LoadDocument(sb.ToString());
and it is works fine.

My Problem: I need to know the bottom of the document.

with mshtml I could use -
mshtml.HTMLDocument doc = this.m_htmldoc;
mshtml.HTMLBodyClass docBody = (mshtml.HTMLBodyClass)(doc.body);
int bodyScrollHeight = docBody.scrollHeight;

but when using HTMlEditor <Body> allways contains only <p></p>
even though I can see the all HTML I have loaded in the control.

what do I need to add in order that this.m_htmldoc.body will update?

Thanks.


Re: m_htmldoc.body doesnot refresh with LoadDocument()
Posted by: Tim (---.priorityevents.net)
Date: Thursday, 30-Oct-2003, 15:37:17

Are you waiting for readyState to go to "complete" before inspecting the body element?

When I tried your code it worked fine with the demo app.

TIm

Re: m_htmldoc.body doesnot refresh with LoadDocument()
Posted by: Atara Halamish (---.bb.netvision.net.il)
Date: Sunday, 02-Nov-2003, 11:16:48

No, I did not.

Where and how should I do this?

Atara.

Re: m_htmldoc.body doesnot refresh with LoadDocument()
Posted by: Tim (142.131.246.---)
Date: Sunday, 02-Nov-2003, 16:04:31

For testing, you can use DoEvents:

- call LoadDocument

while (htmlEditor1.ReadyState != "complete")
{
Application.DoEvents();
}

- now work with the new document

A more robust solution is to handle the control's ReadyStateChanged event. The ReadyState is a property of the event args.

Tim

Re: m_htmldoc.body doesnot refresh with LoadDocument()
Posted by: Atara Halamish (---.bb.netvision.net.il)
Date: Tuesday, 04-Nov-2003, 11:39:51

Thanks.

The simple solution is what I needed.

Atara.




Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
xGVTP
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.