# Programming with Splitter Controls

In addition to general user interface control functions, you can use the following functions with the splitter control:

- AddCtrlToSplitter
- AddPanelToSplitter
- RemoveCtrlFromSplitter
- RemovePanelFromSplitter
- OperateSplitter

You must call the AddCtrlToSplitter and AddPanelToSplitter functions to attach a control or a panel to a splitter control. Controls and panels you attach using these functions must already be created.

You can attach child panels to splitter controls only programmatically. You can attach controls programmatically or through the User Interface Editor.

To specify the edge of the splitter to attach to, specify VAL_LEFT_ANCHOR or VAL_RIGHT_ANCHOR for vertical splitters or VAL_TOP_ANCHOR or VAL_BOTTOM_ANCHOR for horizontal splitters as the anchor parameter in the AddCtrlToSplitter and AddPanelToSplitter functions.

Specify whether to size or move controls or panels using the move parameter in the AddCtrlToSplitter and AddPanelToSplitter functions.

The snapOnAttach parameter specifies whether a control or panel snaps to the location of the splitter when it is attached. If you pass TRUE, controls you attach to vertical splitters shift horizontally, but maintain their vertical position. If you pass TRUE, controls you attach to horizontal splitters shift vertically, but maintain their horizontal position. This shift occurs only once, and you can still move or size the attached controls afterwards.

Controls do not have to be adjacent to the splitter to which they are attached. When you operate the splitter, LabWindows/CVI moves or sizes the control so that the gap between the control and the splitter remains constant.

To use a splitter control as a line decoration, select a classic-style splitter (CTRL_HORIZONTAL_SPLITTER or CTRL_VERTICAL_SPLITTER), set the color with ATTR_FRAME_COLOR, set the thickness with ATTR_FRAME_THICKNESS, and then set ATTR_OPERABLE_AS_INDICATOR to FALSE.

Use the OperateSplitter function to programmatically operate the splitter and its attached controls and panels. With OperateSplitter, you can provide better panel scaling than with the ATTR_SCALE_CONTENTS_ON_RESIZE attribute. You can use OperateSplitter to respond to panel size events to customize the internal scaling of the panel. Refer to the samples\userint\docking.cws example for more information about using OperateSplitter.