Extended version of TSplitter that has clickable area and able to toggle visibility of linked control.
Delphi 7+ supported.
Demo app included.
Could be used with standard TSplitter
without installing new components.
ToggleControl: TControl
- linked control that will be toggled on splitter clickResizeControl: TControl
- (optional) control that will be resized too on splitter click. IfToggleControl.Align
isalClient
and this property is not set,ToggleControl.Parent
will be resized. Set this property to resize other control.DenyDrag: Boolean
- (optional) if True, splitter will ignore mouse dragging (if you want only toggle and not resize). You must changeSplitter.Cursor
to default one by yourself.HotColor: TColor
- (optional) color a Splitter will have when a mouse is over.
Toggle
- toggle the controlSetImages
- Init click image and calculate click area from image's dimensions
- Add this line before form definition:
TSplitter = class(TSplitterEx);
- Place usual
TSplitter
on a form, setAlign
properties of splitter and neighbour controls as usual - Assign
Splitter1.ToggleControl
to control you want to toggle - Prepare an image (I borrowed one from Firefox panel toggler)
- Call
Splitter1.SetImages(ImageShown, ImageHidden);
whereImageShown
isTImage
with image for state when ToggleControl is shown andImageHidden
is for state when it is hidden - Assign optional fields
- Enjoy
- If
ToggleControl.Align
isalClient
, the splitter will change width of a parent control instead. Thus you can toggle controls that go after the splitter.