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
how to avoid the automatic Focus after a document load
Posted by: manitra (---.completel.net)
Date: Wednesday, 28-Mar-2007, 10:24:19

Hi,

Each time I call the LoadDocument() method, the HtmlEditor automatically "grap" the focus.

This is really annoying if you're browsing a list or treeview with the keybord and for each item, call LoadDocument.

Does anyone know a workaround to avoid this behaviour ?

May be, disable/hide the control before calling LoadDocument()

Re: how to avoid the automatic Focus after a document load
Posted by: manitra (---.completel.net)
Date: Wednesday, 28-Mar-2007, 15:12:03

Correction :

the html editor ... automatically "take" the focus.

Re: how to avoid the automatic Focus after a document load
Posted by: Tim (Moderator)
Date: Sunday, 01-Apr-2007, 22:07:44

You can easily prevent this if you make it read-only. Are you using the latest version? If you search this forum you will find much discussion on this subject; the latest version is better behaved than earlier ones.

Tim

Re: how to avoid the automatic Focus after a document load
Posted by: Manitra (---.completel.net)
Date: Wednesday, 04-Apr-2007, 16:08:12

Hi,

Thanks for your answer. Indeed its ok for a read only app. But my scenario is a read/write app that is supposed to manage some remote data.

Here is a screen shoot to better explain my scenario : [manitra.andria.free.fr]

Well the idea is that, I have a tree view containing a list or articles. When the user selects a node, the "detailed view" is filled with the selected node info. Then, the user can edit the content and press the save button.

The focus problem comes when the user uses the keyboad to browse the article list : the treeview looses the focus after each node change because the html editor receives new content and btw takes the focus. Even if the user uses the mouse it is annoying since he doesn't see the selected node (the treeview does not high light its selected node when it does not have the focus).

Btw, I tried to search with the keyword "focus" and got no answer, that's why I created this topic.

Thanks again for you help.

Re: [SOLVED] how to avoid the automatic Focus after a document load
Posted by: Manitra (---.completel.net)
Date: Thursday, 05-Apr-2007, 14:40:33

Hi,

I found a work around ("myEditor" is the reference to the editor instance) :

1) Catch the ReadyStateChanged event with this method
private void DescriptionTxt_ReadyStateChanged(object sender, onlyconnect.ReadyStateChangedEventArgs e)
{
if (e.ReadyState == "complete")
{
myEditor.IsActivationEnabled = true;
}
}

2) As tim said : put in read only :
myEditor.IsActivationEnabled = false;


3) Load the document :
myEditor.LoadDocument("this is some <b>html</b> content");

that's all folk smiling smiley

Thanks for the readonly trick Tim smiling smiley

Re: how to avoid the automatic Focus after a document load
Posted by: Tyrone Hopes (---.range86-140.btcentralplus.com)
Date: Friday, 06-Apr-2007, 10:52:20

Hi All
Manitra mentioned that one problem associated with the taking focus is that the tree view loses focus. I have written something very similar, and I had this problem as well, but is fixed by entering some code in the treeview.Afterselect event. Use this code to allow the tree node to be greyed (like Microsoft Windows Explorer nodes when focus is removed):

Dim tvsn As TreeNode = treeview.SelectedNode
tvsn = tvWebsite.SelectedNode
tvsn.Checked = True
tvsn.BackColor = tvsn.BackColor.LightGray

The effect of this that the tree view node stays highlighted in grey. You can then change the colours back when you move to another node,
Hope it helps
Cheers
Tyrone



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