FIX: DhDocument.setTitle() Does Not Work From initForm() (194767)



The information in this article applies to:

  • Microsoft Visual J++ 6.0

This article was previously published under Q194767

SYMPTOMS

When you try to set the title of DhDocument from initForm(), the new title is not displayed in the title bar of the browser.

RESOLUTION

Do one of the following to work around this issue:
  • Do not call setTile() in initForm(). Call it only after the document has been loaded.
  • Call setTile(getTitle()) in the onDocumentLoad() method.

STATUS

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

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual J++, select New Project from the File menu.
  2. In the New Project dialog box, click the New tab.
  3. In the Visual J++ Projects tree, click Web Pages.
  4. Click Code-Behind HTML.
  5. Click Open to create the project.
  6. Modify Class1.java as follows:
    import com.ms.wfc.html.*;
    import com.ms.wfc.core.*;
    import com.ms.wfc.ui.*;
    
    public class Class1 extends DhDocument
    {
       public Class1()
       {
          initForm();
       }
       private void initForm()
       {
          setTitle("My Title");
       }
       protected void onDocumentLoad(Object sender, Event e)
       {
    
    // Workaround: uncomment the following line or only set the title
    // in the onDocumentLoad.
    //    setTitle(getTitle());
       }
    }
    						
  7. Modify Page1.html as follows:
    <HTML>
    <BODY>
    <hr>
    <OBJECT classid="java:com.ms.wfc.html.DhModule"
         height=0 width=0 ... VIEWASTEXT>
    <PARAM NAME=__CODECLASS VALUE=Class1>
    <PARAM NAME=CABBASE VALUE=Project1.CAB>
    </OBJECT>
    <!-- Insert HTML here -->
    </BODY>
    </HTML>
    						
  8. Run the project.
RESULT: The title of the browser is not "My Title."

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbCmnCtrls kbfix kbJava kbVS600sp3fix kbWFC KB194767