Microsoft KB Archive/319992

= BUG: Paint Problem Exists with Dynamically Generated Select Box in MFC CHTML View-Based Application =

Article ID: 319992

Article Last Modified on 5/18/2007

-

APPLIES TO


 * Microsoft Internet Explorer (Programming) 5.5 SP2
 * Microsoft Internet Explorer (Programming) 6.0

-



This article was previously published under Q319992



SYMPTOMS
If you dynamically change the text in a select box that is under another select box in a Microsoft Foundation Classes (MFC) hosted Web browser control by clicking the drop-down menu in the top select box, the bottom select box and the new text are not drawn correctly.



CAUSE
The drop-down menu that appears causes problems with the redrawing in an MFC application.



RESOLUTION
You can work around this problem if you arrange the two select boxes in such a manner that the drop-down menu does not cover the bottom select box.

You can also work around this problem if you delay the text change by using the setTimeout function call. The &quot;More Information&quot; section of this article shows you an example.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
 Create an MFC-hosted Web browser control application. For example, you can create the default Single Document Interface (SDI) MFC CHtmlView class in the application. Build the application. You do not have to make code changes.  Create a test Hypertext Markup Language (.html) file that contains the following code. This sample has the workaround commented out. Test.htm  function MyOnChange(e) {   // bug ChangeOptionText; // workaround // setTimeout(&quot;ChangeOptionText&quot;, 1); return; }

function ChangeOptionText {   select2.options[0].text = &quot; Option 1b&quot;; }  Option 1 Option 2  Option 1a  Run the MFC application and drag the Test.htm file to the View window of the MFC application. The page appears.</li> In the top select box, click Option 2. This changes the text of the bottom select box and you can see the problem. This problem does not occur if you test the page in Internet Explorer.NOTE: You can change the test page to use the workaround if you comment the line under the comment &quot;//bug&quot;, and then uncomment the line under &quot;//workaround&quot;.</li></ol>

<div class="references_section">