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
Setting Focus back to the editor
Posted by: (62.48.170.---)
Date: Wednesday, 07-May-2003, 16:13:33

Hi,

After selecting a value in a comboxbox I would like to set the focus back to the editor, so that the user could keep on writing without having to select the editor (eg. by clicking on it with the mouse). But

Me.htmleditor1.Focus()

doesn´t seem to work. Maybe it only sets focus to the control and not to the editing area...



Thanks in advance

Re: Setting Focus back to the editor
Posted by: James Hancock (---.darwinconsulting.com)
Date: Wednesday, 07-May-2003, 18:30:37

This is a larger issue because if you use the tab key to tab into the control you can't start typing, although the focus appears to be on the control from the WndProc messages that I'm seeing.

Tim do you have an ideas? I was about to ask you about this one.

Re: Setting Focus back to the editor
Posted by: Tim Anderson (---.server.ntl.com)
Date: Thursday, 08-May-2003, 06:58:00

I think we could hack this by forwarding the focus to the mshtml window - we know its hwnd.

Tim

Re: Setting Focus back to the editor
Posted by: (62.48.170.---)
Date: Thursday, 08-May-2003, 14:38:06

I guess it's not htmleditor1.Handle... that returns the handle of the control were the editor is located. So how can I find the handle to the mshtml window and how to set the focus?

Thanks in advance

Re: Setting Focus back to the editor
Posted by: James Hancock (---.darwinconsulting.com)
Date: Thursday, 08-May-2003, 16:17:52

I tried forwarding these messages from the WndProc and it got the focus, but the cursor didn't show up and you couldn't type even though the right wndproc was receiving messages for keypresses etc....

Any other ideas?

Re: Setting Focus back to the editor
Posted by: (62.48.170.---)
Date: Thursday, 08-May-2003, 16:27:28

Got it again...

htmleditor1.document.focus() sets the focus back to the editing area.

Re: Setting Focus back to the editor
Posted by: James Hancock (---.darwinconsulting.com)
Date: Thursday, 08-May-2003, 17:44:11

This sort of works.... however if you tab into the control this doesn't set the cursor correctly so that you can't type.

What I've done is override on the OnEnter event and put the code from above in it. It makes the editor get the focus, you can get the font size, style etc., but you can't just type.

Anyone have any ideas how to get to the cursor to show?



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