How to Use Splits > Creating and Resizing Splits through User Interaction |
You can always create and resize splits in code. However, you can also let your users create and resize splits interactively by setting the AllowSizing property of a split to True. By default, the AllowSizing property is False, and users are prevented from creating and resizing splits.
A typical list with AllowSizing set to False is shown in the following figure. Notice that there is no split box at the left edge of the horizontal scroll bar.
If you set the split's AllowSizing property to True:
Example Title |
Copy Code
|
---|---|
TDBList1.Splits(0).AllowSizing = True |
A split box will appear at the left edge of the horizontal scroll bar, and the user will be able to create new splits at run time.
When the user points to the split box, the pointer will turn into a double vertical bar with a down arrow, which the user can drag to the right to create a new split, as shown in the next figure.
The new split will inherit its properties from the original split. The SizeMode properties of both splits will be automatically set to 0 - Scalable, regardless of the SizeMode of the original split. The Size properties of both splits will be set to the correct ratio of the splits' sizes. The values of the Size properties may end up being rather large. This is because True DBList needs to choose the least common denominator for the total split size, and the user may drag the pointer to an arbitrary position.
Note that both splits' AllowSizing properties are now True, and the divider between them is a double line, which indicates that the splits' sizes are now adjustable. If the user points to the split box between the two splits, the pointer will turn into a double vertical bar with horizontal arrows. The user can drag this pointer to the left or right to adjust the relative sizes of the splits.
If you set AllowSizing to False for either split, the user will no longer be able to adjust the split sizes. Suppose that you disable sizing for the first split:
Example Title |
Copy Code
|
---|---|
TDBList1.Splits(0).AllowSizing = False |
The split box at the left edge of the horizontal scroll bar in the first split will disappear and the divider between the two splits will turn into a solid line. This means that the user will no longer be able to create a new split from the first split, or adjust the sizes of either split. However, since the split box at the left edge of the second split still exists, the user can now create new splits by pointing to this split box and dragging the pointer to the right.
To summarize:
You can always create or resize splits in code, but the AllowSizing property controls whether users can create or resize splits interactively at run time.
The user can resize the relative sizes of two splits only if both splits' AllowSizing properties are True. When the user completes a resize operation, the total size of the two splits remains unchanged, but the SizeMode properties of both splits will automatically be set to 0 - Scalable regardless of their previous settings. The Size properties of the two splits will be set to reflect the ratio of their new sizes.
The user can create a new split by dragging the split box to the right, as long as both of the following conditions are met. First, the AllowSizing property of the split to the right of the split box must be True. Second, the AllowSizing property of the split to the left of the split box must be False, or the split box must belong to the leftmost split. The total size of the new split and the parent split will be equal to the original size of the parent split. The SizeMode properties of the two splits will be automatically set to 0 - Scalable, and the Size properties of the two splits will be set to reflect the correct ratio of their new sizes.