none
Curious Control Losing Focus Problem RRS feed

  • Question

  • I'm writing an application that takes text from a rich text box puts it in an html file and loads it up in  a web browser control.

    When you type in the rich text box, a timer fires and waits to see if you are still typing. When you have finished typing it will update the browser. This system works fine and the controls keep their focus as expected.

    However, if i simply click in the browser and then click back into the rich text box and begin to type, once the timer fires to update the browser, the focus never goes back to the rich text box until i click it again and I will lose focus again after i type. I've tried to forcefully give the focus back after the browser refreshes, but i'm not having any luck(i might not be doing it late enough, i don't know the last message sent for the browser).

    A couple other things that i've noticed are that:
    1. This error only occurs if i do browser.Refresh(), if i do browser.Navigate(url), it will work fine.
    2. This error only occurs when i have the rich text box contained in a tab control, if i move the text box out of the tab control it works fine for some reason.
    3. if i run this in debugging mode and step through the code it will not lose focus(so it might be a timing issue)

    Any ideas on this would be greatly appreciated.
    Thanks!
    Saturday, August 19, 2006 5:00 AM

All replies

  • Sorry to bump this, but i have been fighting with this for a long time and i've run out of ideas. I need a fresh opinion on the problem.
    Saturday, August 19, 2006 5:28 PM