Groups | Blog | Home
all groups > dotnet compact framework > april 2004 >

dotnet compact framework : OpenNETCF HTMLViewer's Clear() method, re-post


Peter Foot [MVP]
4/6/2004 5:37:25 PM
Yes the Clear method should clear all the contents of the viewer. What
device type are you using? can you post a code snippet of how you are
populating and clearing the content?

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org


[quoted text, click to view]

Christian Schwarz
4/6/2004 9:24:43 PM
Hello,

beforehand, sorry for posting my problem again. But I really need to solve
this one ...

Is the Clear() method supposed to clear the HTMLViewer's content ? What
could be the problem in case it simply doesn't clear ?

Greetings, Christian

Christian Schwarz
4/7/2004 9:02:38 AM
[quoted text, click to view]

I'm using a CASIO DT-X10 running Windows CE .NET 4.1. Here's a part of my
code:

HTMLViewer viewer = new HTMLViewer();
viewer.Location = new System.Drawing.Point(8, 8);
viewer.Size = new System.Drawing.Size(216, 240);
viewer.EnableClearType = true;
viewer.EnableContextMenu = false;
viewer.Scripting = false;
viewer.ShrinkMode = false;
viewer.Url = "";

viewer.AddText("<body>This is <b>bold</b> !</body>", false);
viewer.EndOfSource();

viewer.Clear();

viewer.AddText("<body>This is <b>bold</b> !</body>", false);
viewer.EndOfSource();

At this point, the HTMLViewer shows the string "This is bold !" two times.

Greetings, Christian

Christian Schwarz
4/13/2004 7:22:06 PM
[quoted text, click to view]

Gladly, I've found a solution: the HTMLViewer control clears as soon as it
receives a WM_SETTEXT message with an empty string. So I've changed the
Clear() method:

public void Clear()
{
//clear local text
this.Text = "";
#if !DESIGN
// m_msgwnd.SendMessage((int)HtmlMessage.Clear, 0, 0);

IntPtr stringptr = Core.StringToPointer("");
m_msgwnd.SendMessage((int)HtmlMessage.WM_SETTEXT, 0, (int)stringptr);
Core.LocalFree(stringptr);
#endif
}

Greetings, Christian

AddThis Social Bookmark Button