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

ID: Q108659

3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

SYMPTOMS

When an Outline custom control has both:

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:

or

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

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

Last Reviewed: November 1, 1997