ComponentOne List 8.0 for ActiveX
Tutorial 12 - Creating a List with Fixed, Nonscrolling Columns

Often, you would like to prevent one or more columns from scrolling horizontally so that they will always be in view. The Splits collection of True DBList provides a generalized mechanism for defining groups of adjacent columns, and can be used to implement any number of fixed, nonscrolling columns. In this tutorial, you will learn how to write code to create a list with two splits, and then "fix" a pair of columns in the leftmost split.

  1. Follow steps 1 through 5 of Tutorial 1 to create a project with a True DBList control bound to a Data control.

  2. In the Form_Load (Visual Basic) event, place the following code to create an additional split and to fix columns 0 and 1 in the leftmost split:

    Example Title
    Copy Code
    Private Sub Form_Load()
    
        ' Before modifying the list's properties, make sure the
    
        ' list is initialized by refreshing the Data control.
    
        Data1.Refresh
    
      
    
        ' Create an additional split:
    
        Dim S As TrueDBList80.Split
    
        Set S = TDBList1.Splits.Add(0)
    
     
    
        ' Hide all columns in the leftmost split, Splits(0),
    
        ' except for columns 0 and 1
    
        Dim C As TrueDBList80.Column
    
        Dim Cols As TrueDBList80.Columns
    
        Set Cols = TDBList1.Splits(0).Columns
    
        For Each C In Cols
    
             C.Visible = False
    
        Next C
    
        Cols(0).Visible = True
    
        Cols(1).Visible = True
    
     
    
        ' Configure Splits(0) to display exactly two columns,
    
        ' and disable resizing
    
        With TDBList1.Splits(0)
    
             .SizeMode = dblNumberOfColumns
    
             .Size = 2
    
             .AllowSizing = False
    
       End With
    
     
    
        ' Usually, if you fix columns 0 and 1 from scrolling
    
        ' in a split, you will want to make them invisible in
    
        ' other splits:
    
        Set Cols = TDBList1.Splits(1).Columns
    
        Cols(0).Visible = False
    
        Cols(1).Visible = False
    
     
    
    End Sub
    

Run the program and observe the following:

To end the program, press the End button on the Visual Basic toolbar. You have successfully completed Tutorial 12.

You can use splits to create fixed, nonscrolling columns anywhere within the list---even in the middle! You can also use splits to present different views of your data. For example, you can create splits which scroll independently (in the vertical direction) so that users may compare records at the beginning of the database with those at the end. For more information, see How to Use Splits.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback