AddBlock Method
Description
Adds a block or key to this track.
Syntax
Public Function AddBlock( _
ByVal IsKey As Boolean, _
ByVal Position As Integer, _
ByVal Length As Integer _
) As TrackBlock
Parameters
- IsKey: True to add a key, False to add a block.
- Position: Position in the time line to add the block or key.
- Length: Length, in time units, of the block that will be added. This does not apply to keys, so you can set it to 0 for keys.
Return Type
Reference to the TrackBlock that was added.
Remarks
AddBlock adds a block or key to this track.
The TrackBlock object is used to represent both Blocks and Keys.
Track Blocks are a visual representation of units of time in a track. They can have both a minimum and maximum time period. For example, a given block can represent 25 units of time, but can no less than 15 and no more than 30 units of time.
Dim TrackItem As TrackControlItem
Dim Block As TrackBlock
Set TrackItem = TrackControl.CreateTrackItem
Record.AddItemEx TrackItem
Set Block = TrackItem.AddBlock(False, 15, 25)
Block.MinLength = 15
Block.MaxLength = 30
Block.Color = RGB(255, 219, 117)
The code above adds a block that represents 25 time units. It is placed within the track at 15 time units. Also note that the first parameter of AddBlock is False, which indicates we are adding a block as opposed to a key.
Blocks can also be different heights and set to different vertical alignments within the track. This is used just as a visual aid to make different blocks in the track visually distinct from each other.
Block.HeightPercent = 0.5
The code above simply makes the block 50% the size of the track height.
Keys are used simply as "notes" or reference points in the track. They can be added anywhere in the track to make note of some event at the given moment in time.
TrackItem.AddBlock(True, 70, 0)
The code above will add a key at time unit 70; the last parameter, size, is ignored when adding keys. Note that the first parameter is True, which tells AddBlock to add a key as opposed to a block.

See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.