FIX: First Item Can Disappear in Outline Control Style 0 or 2

Last reviewed: October 30, 1997
Article ID: Q108659
3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

  • Professional Edition of Microsoft Visual Basic for Windows, version 3.0

SYMPTOMS

When an Outline custom control has both:

  • Style property value of 0 or 2
  • Indent property value of 0 on an item

the first visible item in the outline incorrectly disappears when you initially click any other item at run time. The problem occurs both in the Visual Basic environment and in compiled EXE files.

By design, the item that has an Indent property of 0 should not display. However this should not have any effect on the items that do display.

WORKAROUND

The first item reappears as soon as you select it with the mouse or keyboard. The keyboard interface for the Outline control includes LEFT ARROW, RIGHT ARROW, UP ARROW, DOWN ARROW, HOME, END, PAGE UP, PAGE DOWN, plus sign (+), and minus sign (-).

You can prevent the disappearance of the first item as follows:

  • Do not use an Indent value of 0 on items in an Outline control that uses Style property values of 0 or 2. Instead, use an Indent value of 1 or greater.

or
  • Add the Outline1.ListIndex=1 statement after you add all items and indents to the Outline control. This ListIndex method selects the first item automatically, working around the problem.

STATUS

Microsoft has confirmed this to be a bug in the Professional Edition of Microsoft Visual Basic version 3.0 for Windows. This problem has been corrected in Visual Basic version 4.0.

MORE INFORMATION

NOTE: An item that has an Indent property of 0 will be visible when you use Style property values of 1, 3, 4, and 5, which include pictures or tree lines. The bug mentioned in this article does not occur for these styles.

Steps to Reproduce Behavior

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. From the File menu, choose Add File. Add the MSOUTLIN.VBX control file from your WINDOWS\SYSTEM directory.

  3. Add an Outline custom control to the form.

  4. Select the Outline control and press the F4 key to display the Properties window. Set the Style property to 0 or 2:

          0 - Text Only
    
    or

          2 - Plus/Minus and Text
    

  5. Double-click the form to display the code window. Add the following code to the Form Load event:

       Sub Form_Load ()
          For i = 0 To 4
             ' Note that item 0 will not be visible, by design.
             outline1.AddItem Str$(i)
             outline1.Indent(i) = i
          Next
          For i = 1 To 4
             outline1.Expand(i - 1) = True
          Next
          ' Add the following statement to work around the bug:
          ' Outline1.ListIndex=1
       End Sub
    
    

  6. Start the program, or press the F5 key. To duplicate the problem, click any item except the first. The first item, 1, incorrectly disappears.

    As long as you click any item except the first, the first item remains invisible. As soon as you click the first item, it correctly appears.

To work around the problem, add Outline1.ListIndex=1 to the end of the code listed in step 5. The ListIndex method selects the first item automatically.

REFERENCES

  • "Microsoft Visual Basic Version 3.0: Professional Features Book 1: Custom Control Reference." See the Outline control, pages 256-257.


Additional reference words: buglist3.00 3.00 fixlist4.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus
Keywords : PrgCtrlsCus kbbuglist kbprg
Version : 3.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.