OpenNETCF HTMLViewer's Clear() method, re-post

  • Thread starter Thread starter Christian Schwarz
  • Start date Start date
C

Christian Schwarz

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

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
 
Yes the Clear method should clear all the contents of the viewer. What
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.

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
 
Back
Top