property Items.ItemDivider(Item as HITEM) as Long
Specifies whether the item acts like a divider or normal item.

 TypeDescription 
   Item as HITEM A long expression that indicates the item's handle.  
   Long A long expression that indicates the column's index.  

A divider item uses the item's client area to display a single cell. You can use the ItemDivider property to separate the items, display groups of items or display total or subtotals fields. The ItemDivider property specifies the index of the cell being displayed in the item's client area. In other words, the divider item merges the item cells into a single cell. The CellHAlignment property specifies the horizontal alignment for the cell's content. Use the ItemDividerLine property to define the line that underlines the divider item. Use the LockedItemCount property to lock items on the top or bottom side of the control. Use the MergeCells method to combine two or multiple cells in a single cell. Use the SelectableItem property to specify the user can select an item. A divider item has sense for a control with multiple columns. The SortableItem property specifies whether the item keeps its position after sorting.

The following screen shot shows the items arranged as groups ( Group 5 and Group 6 are divider items ):

The following screen shot shows subtotals items ( 42 and 73 are divider items ):

The following screen shot shows subtotals items in combination with EBN features:

The following VB sample adds a divider item between two child items:

Private Sub Form_Load()
    With Grid1
        .BeginUpdate
            .DefaultItemHeight = 24
            .MarkSearchColumn = False
            .HeaderVisible = False
            .LinesAtRoot = exLinesAtRoot
            .HasButtons = exCircle
            With .Columns
                With .Add("Column 1")
                    .SortType = EXGRIDLibCtl.SortTypeEnum.SortCellData
                End With
                With .Add("Column 2")
                    .Visible = False
                End With
            End With
            
            With .Items
                Dim h As HITEM, g As HITEM
                h = .InsertItem(, , "Father")
                .InsertItem h, 1, "Son 1"
                g = .InsertItem(h, 50, "")
                .CellValue(g, 1) = "This is a bit of text that should appear between <b>Son 1</b> and <b>Son 2</b>"
                .CellValueFormat(g, 1) = exHTML
                .CellSingleLine(g, 1) = False
                .ItemDivider(g) = 1
                .ItemDividerLine(g) = EmptyLine
                .InsertItem h, 99, "Son 2"
                .ExpandItem(h) = True
            End With
        .EndUpdate
    End With
End Sub

The following VB sample adds a divider item, that's not selectable too:

With Grid1.Items
    Dim i As Long
    i = .AddItem("divider item")
    .ItemDivider(i) = 0
    .SelectableItem(i) = False
End With

The following C++ sample adds a divider item, that's not selectable too:

#include "Items.h"
CItems items = m_grid.GetItems();
long i = items.AddItem( COleVariant("divider item") );
items.SetItemDivider( i, 0 );
items.SetSelectableItem( i, FALSE );

The following C# sample adds a divider item, that's not selectable too:

int i = axGrid1.Items.AddItem("divider item");
axGrid1.Items.set_ItemDivider(i, 0);
axGrid1.Items.set_SelectableItem(i, false);

The following VB.NET sample adds a divider item, that's not selectable too:

With AxGrid1.Items
    Dim i As Integer
    i = .AddItem("divider item")
    .ItemDivider(i) = 0
    .SelectableItem(i) = False
End With

The following VFP sample adds a divider item, that's not selectable too:

with thisform.Grid1.Items
	.DefaultItem = .AddItem("divider item")
	.ItemDivider(0) = 0
	.SelectableItem(0) = .f.
endwith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.