cSplitterContainer objects are used to implement splitter dialogs - two containers separated by a splitter. A cSplitterContainer object can be dropped into any container -- (typically a view). This dropped object will consist of the cSplitterContainer and two, and only two, cSplitterContainerChild child objects. You can then place any other child containers or controls you wish inside either of the two cSplitterContainerChild container objects. The size of either container can be adjusted by dragging the splitter.
For example, a non-splitter view might have the following structure:
Object oView is a View Object oForm1 is a Form Set Size to 13 51 Set Location to 5 51 End_Object Object oForm2 is a Form Set Size to 13 51 Set Location to 25 51 End_Object End_Object
This can be changed into a splitter view by inserting cSplitterContainer / cSplitterContainerChild(s) object as follows.
Object oView is a View Object oSplitterContainer1 is a cSplitterContainer Set pbSplitVertical to False Set piSplitterLocation to 100 Object oSplitterContainerChild1 is a cSplitterContainerChild Object oForm1 is a Form Set Size to 13 51 Set Location to 5 51 End_Object End_Object Object oSplitterContainerChild2 is a cSplitterContainerChild Object oForm2 is a Form Set Size to 13 51 Set Location to 5 51 End_Object End_Object End_Object End_Object
A number of design-time properties are defined in the cSplitterContainer class which can be used to customize the appearance and behavior of splitter. Note that the cSplitterContainerChild contains no splitter related design-time properties.
A splitter's orientation can be horizontal or vertical and is controlled by the pbSplitVertical property
The splitter's initial location is controlled by the piSplitterLocation property.
The minimum (left / top) and maximum (right / bottom) position of a splitter are determined by the piMinSplitterLocation and piMaxSplitterLocation properties.
When a splitter's parent container (e.g. a view) is resized, only one of the two splitter child containers is resized. This is controlled by the peFixedPanel property.
The cSplitterContainerChild objects are the regular containers and therefore they do not scroll. Often you will want to support scrolling in one or both sides of a splitter. Some controls such as an editor (cRichEdit, cDbTextEdit, etc.) or a tree view (TreeView) support scrolling themselves. In such a case, you would drop this object in the container, set its size and location to fill the container and set its peAnchors to anAll. If you have non-scrolling controls, such as forms and buttons, that need to be scrolled, you can drop a cScrollingContainer object into the cSplitterContainerChild and scrolling will be supported.
This shows a splitter that contains a tree view on the left, which supports its own scrolling and a scrolling container on the right.
Object oView is a View Object oSplitterContainer1 is a cSplitterContainer Set pbSplitVertical to True Set piSplitterLocation to 100 Object oSplitterContainerChild1 is a cSplitterContainerChild Object oT1 is a TreeView Set Size to y x // size to fill the entire container Set peAnchors to anAll End_Object End_Object Object oSplitterContainerChild2 is a cSplitterContainerChild Object oScrollingContainer1 is a cScrollingContainer Object oScrollingClientArea1 is a cScrollingClientArea Object oForm1 is a Form Set Size to 13 51 Set Location to 5 51 End_Object Object oForm2 is a Form Set Size to 13 51 Set Location to 25 51 End_Object End_Object End_Object End_Object End_Object
When a cSplitterContainer is dropped from the Studio's Class Palette onto a component, such as a view, an object of class cSplitterContainer is created and inside it, two objects of class cSplitterContainerChild. You can change the initial location of the splitter by dragging the splitter.