ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Referencing Splits and their Properties

A C1TrueDBGrid object initially contains a single horizontal split. If additional splits are created, you can determine or set the current split (that is, the split that has received focus) using the grid's SplitIndex property:

·      Visual Basic

' Read the zero-based index of the current split.

Dim idx as Integer = Me.C1TrueDBGrid1.SplitIndex

 

' Set focus to the split with an index equal to Variable%.

Me.C1TrueDBGrid1.SplitIndex = idx

·      C#

// Read the zero-based index of the current split.

int idx = this.C1TrueDBGrid1.SplitIndex;

 

// Set focus to the split with an index equal to Variable%.

this.C1TrueDBGrid1.SplitIndex = idx;

·      Delphi

// Read the zero-based index of the current split.

Variable% := Self.C1TrueDBGrid1.SplitIndex;

 

// Set focus to the split with an index equal to Variable%.

Self.C1TrueDBGrid1.SplitIndex := Variable%;

Each split in a grid is a different view of the same data source, and behaves just like an independent grid. If additional splits are created without customizing any of the split properties, all splits will be identical and each will behave very much like the original grid with one split.

Note that some properties, such as RecordSelectors and MarqueeStyle, are supported by both the C1TrueDBGrid and Split objects. Three rules of thumb apply to properties that are common to a grid and its splits:

1.   When you set or get the property of a Split object, you are accessing a specific split, and other splits in the same grid are not affected.

2.   When you get the property of a C1TrueDBGrid object, you are accessing the same property within the current split.

3.   When you set the property of a C1TrueDBGrid object, you are setting the same property within all splits.

To understand how these rules work in code, consider a grid with two horizontal splits, and assume that the current split index is 1. To determine which marquee style is in use, the following statements are equivalent:

·      Visual Basic

marquee = Me.C1TrueDBGrid1.MarqueeStyle

marquee = Me.C1TrueDBGrid1.Splits(1).MarqueeStyle

marquee = Me.C1TrueDBGrid1.Splits(Me.C1TrueDBGrid1.SplitIndex).MarqueeStyle

·      C#

marquee = this.C1TrueDBGrid1.MarqueeStyle;

marquee = this.C1TrueDBGrid1.Splits[1].MarqueeStyle;

marquee = this.C1TrueDBGrid1.Splits[this.C1TrueDBGrid1.SplitIndex].MarqueeStyle;

·      Delphi

marquee% := Self.C1TrueDBGrid1.MarqueeStyle;

marquee% := Self.C1TrueDBGrid1.Splits[1].MarqueeStyle;

marquee% := Self.C1TrueDBGrid1.Splits[Self.C1TrueDBGrid1.SplitIndex].MarqueeStyle;

To change the marquee style to a solid cell border for all of the splits in the grid, use:

·      Visual Basic

Me.C1TrueDBGrid1.MarqueeStyle = MarqueeEnum.SolidCellBorder

·      C#

this.C1TrueDBGrid1.MarqueeStyle = MarqueeEnum.SolidCellBorder;

·      Delphi

Self.C1TrueDBGrid1.MarqueeStyle := MarqueeEnum.SolidCellBorder;

Note that this statement is equivalent to:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.SolidCellBorder

Me.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.SolidCellBorder

·      C#

this.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.SolidCellBorder;

this.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.SolidCellBorder;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].MarqueeStyle := MarqueeEnum.SolidCellBorder;

Self.C1TrueDBGrid1.Splits[1].MarqueeStyle := MarqueeEnum.SolidCellBorder;

Likewise, to set the marquee style of each split to a different value:

·      Visual Basic

Me.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.NoMarquee

Me.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.FloatingEditor

·      C#

this.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.NoMarquee;

this.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.FloatingEditor;

·      Delphi

Self.C1TrueDBGrid1.Splits[0].MarqueeStyle := MarqueeEnum.NoMarquee;

Self.C1TrueDBGrid1.Splits[1].MarqueeStyle := MarqueeEnum.FloatingEditor;

These rules apply only to a C1TrueDBGrid object and its associated Split objects. No other object pairs possess similar relationships.


Split Properties Common to C1TrueDBGrid

Split-Only Properties Not Supported by C1TrueDBGrid


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.