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
Selecting an element failed when the cursor is on free text (on the body)
Posted by: liorklain (
Date: Sunday, 15-Oct-2006, 16:39:30

I use external list of my objects (Html Elements) to select html elements in
the htmleditor, when other element selected already i successed but when a text is selected this code is failed:

HtmlSelection selection = this.Document.selection;
HtmlControlRange range;

// get selection range
range = (HtmlControlRange)selection.createRange();

// if item is already selected return from selection
if ((range != null) && (range.length > 0))
if (range.item(0) == htmlElement)

// clear all selected items
while (range.length > 0)

// add selected element to the range of selection
range.add(htmlElement as IHTMLControlElement);

// set the range to be selected;

catch (Exception ex)

can somebody help me?

thank you, lior

Your Name: 
Your Email: 
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.
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.