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
Automatically scrolling to the bottom
Posted by: Shawn Bruckner (---.hsd1.mi.comcast.net)
Date: Sunday, 21-Oct-2007, 18:27:16

I need a way to do the following things:

- Determine the current position of the vertical scroll. (Primarily to determine whether it is at bottom, but it'd be nice to save the current scroll position as well.)
- Change the position of the vertical scroll, either to a previously saved position or to the bottom.

One of the things I need to do is if the scroll bar is at bottom, I need to move it back there after the document is updated. I had a way to do this using GetScrollInfo and SendMessage on other controls, but the HtmlEditor does not seem to respond to these. I thought of trying to use Javascript in the document itself, but I'm having little luck with this approach too...

Does anyone else have any ideas?

Re: Automatically scrolling to the bottom
Posted by: Shawn (---.hsd1.mi.comcast.net)
Date: Monday, 22-Oct-2007, 09:23:44

Heh... never mind. I was trying to be too complicated, looking at WndProc messages or trying Javascript... the answers I needed were in the mshtml.IHTMLElement and mshtml.IHTMLElement2.

IHTMLElement2.scrollTop tells me where the scroll bar is, and I just use the offsetHeight of the various elements of the page minus the IHTMLElement2.clientheight to determine what value of the scroll bar will be at the bottom. It'll also be easy to save IHTMLElement2.scrollTop to restore position when needed. Just had to look in the proper place...

Re: Automatically scrolling to the bottom
Posted by: Mijail Paz (---.net)
Date: Thursday, 08-May-2008, 22:32:55

It more easy if you use mshtml.HTMLWindow2

something like this

mshtml.HTMLDocument doc;
doc = mi_htmlEditor.Document
doc.parentWindow.scrollTo(0, 9999);

that it tongue sticking out smiley



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.
CDnvn
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.