TPairSplitter: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | - | ||
| 3 | - | ||
| 1 | + | A TPairSplitter [](</File:tpairsplitter.png>) is a component that can be placed on a panel or form and provides two [[TPairSplitterSide]] sub-components. | |
| 4 | 2 | ||
| 5 | - | ||
| 3 | + | In the example below, a [[TPaintBox]] item is dropped onto each TPairSplitterSide. | |
| 6 | 4 | ||
| 7 | - | ||
| 5 | + | [](</File:component-TPairSplitter.png>) | |
| 6 | + | ``` | |
| 8 | 7 | unit Unit1; | |
| 9 | - | ||
| 10 | - | ||
| 8 | + | ||
| 9 | + | {$mode objfpc}{$H+} | |
| 10 | + | ||
| 11 | + | interface | |
| 12 | + | ||
| 13 | + | uses | |
| 14 | + | Classes, SysUtils, Forms, | |
| 15 | + | Controls, PairSplitter, ExtCtrls; | |
| 16 | + | ||
| 17 | + | type | |
| 18 | + | TForm1 = class(TForm) | |
| 19 | + | PaintBox1: TPaintBox; | |
| 20 | + | PaintBox2: TPaintBox; | |
| 21 | + | PairSplitter1: TPairSplitter; | |
| 22 | + | PairSplitterSide1: TPairSplitterSide; | |
| 23 | + | PairSplitterSide2: TPairSplitterSide; | |
| 24 | + | end; | |
| 25 | + | ||
| 26 | + | var | |
| 27 | + | Form1: TForm1; | |
| 28 | + | ||
| 29 | + | implementation | |
| 30 | + | ||
| 31 | + | {$R *.lfm} | |
| 32 | + | ||
| 33 | + | { TForm1 } | |
| 34 | + | ||
| 35 | + | end. | |
| 36 | + | ``` | |
| 11 | 37 | ||
| 12 | - | ||
| 38 | + | ## Differences in TSplitter and TPairSplitter behaviour | |
| 13 | 39 | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 40 | + | [](</File:SplitterVariationsAndResize.png> "lossy=false") | |
| 17 | 41 | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 42 | + | **TPairSplitter** behaves and looks like a [[TSplitter]] with two TPanel client areas attached to each side of it in a single control. The TPairSplitter control itself is usually set to alClient to fill its parent space entirely. Each side can be filled with other controls, which usually are also set to alClient. The property **SplitterType** controls wether to use horizontal or vertical splitting. | |
| 26 | 43 | ||
| 27 | - | ||
| 28 | - | ||
| 44 | + | The divider position in between the containers is defined by the property **Position** in terms of pixels (absolute positioning). A TPairSplitter behaves exactly like a TSplitter during run-time in terms of distribution of additional space when resizing the outer container element: There is one side that acts like the fixed part as if aligned to alTop/alBottom or alLeft/alRight (depending on split orientation vertically or horizontally) and one that acts like if aligned to alClient. Additional space will be distributed asymmetrically, that is only the alClient part will receive additional space in both directions (becomes evident considering the absolute pixel value of the position property which is not recomputed automatically). | |
| 29 | 45 | ||
| 30 | - | ||
| 46 | + | The splitter divider element cannot be manipulated by mouse during design-time, but can be adjusted by the position property in the Object Inspector. Changing the width/height of controls on either side does not work during design-time (neither using the mouse nor the Object Inspector). This is probably true for run-time also, since the position property is to be used in this case. | |
| 31 | 47 | ||
| 32 | - | ||
| 48 | + | By using the position property, an evenly distribution of additional space can be achieved easily in code by making an assignment in the OnResize event handler like: `Splitter.Position := Splitter.Width div 2`. This is not exactly the same as a proportional distribution though, which would need to store and restore a position value before/after the resizing. If something like that is needed, see the article on [[TSplitter|TSplitter and AnchorSides]]. | |
| 33 | 49 | ||
| 34 | - | ||
| 50 | + | ## See also | |
| 35 | 51 | ||
| 36 | - | ||
| 37 | - | ||
| 52 | + | * [TPairSplitter doc](<http://lazarus-ccr.sourceforge.net/docs//lcl/pairsplitter/tpairsplitter.html> "doc:/lcl/pairsplitter/tpairsplitter.html") | |
| 53 | + | * [[TSplitter]] | |
| 38 | 54 | ||
| 39 | - | ||
| 55 | + | ||
| 40 | 56 | ||
| 41 | - | ||
| 42 | - | ||
| 57 | + | [[LCL Components]] Component Tab | Components | |
| 58 | + | ---|--- | |
| 59 | + | [[Standard tab|Standard]] | [[TMainMenu]] • [[TPopupMenu]] • [[TButton]] • [[TLabel]] • [[TEdit]] • [[TMemo]] • [[TToggleBox]] • [[TCheckBox]] • [[TRadioButton]] • [[TListBox]] • [[TComboBox]] • [[TScrollBar]] • [[TGroupBox]] • [[TRadioGroup]] • [[TCheckGroup]] • [[TPanel]] • [[TFrame]] • [[TActionList]] | |
| 60 | + | [[Additional tab|Additional]] | [[TBitBtn]] • [[TSpeedButton]] • [[TStaticText]] • [[TImage]] • [[TShape]] • [[TBevel]] • [[TPaintBox]] • [[TNotebook]] • [[TLabeledEdit]] • [[TSplitter]] • [[TTrayIcon]] • [[TControlBar]] • [[TFlowPanel]] • [[TMaskEdit]] • [[TCheckListBox]] • [[TScrollBox]] • [[TApplicationProperties]] • [[TStringGrid]] • [[TDrawGrid]] • TPairSplitter • [[TColorBox]] • [[TColorListBox]] • [[TValueListEditor]] | |
| 61 | + | [[Common Controls tab|Common Controls]] | [[TTrackBar]] • [[TProgressBar]] • [[TTreeView]] • [[TListView]] • [[TStatusBar]] • [[TToolBar]] • [[TCoolBar]] • [[TUpDown]] • [[TPageControl]] • [[TTabControl]] • [[THeaderControl]] • [[TImageList]] • [[TPopupNotifier]] • [[TDateTimePicker]] | |
| 62 | + | [[Dialogs tab|Dialogs]] | [[TOpenDialog]] • [[TSaveDialog]] • [[TSelectDirectoryDialog]] • [[TColorDialog]] • [[TFontDialog]] • [[TFindDialog]] • [[TReplaceDialog]] • [[TTaskDialog]] • [[TOpenPictureDialog]] • [[TSavePictureDialog]] • [[TCalendarDialog]] • [[TCalculatorDialog]] • [[TPrinterSetupDialog]] • [[TPrintDialog]] • [[TPageSetupDialog]] | |
| 63 | + | [[Data Controls tab|Data Controls]] | [[TDBNavigator]] • [[TDBText]] • [[TDBEdit]] • [[TDBMemo]] • [[TDBImage]] • [[TDBListBox]] • [[TDBLookupListBox]] • [[TDBComboBox]] • [[TDBLookupComboBox]] • [[TDBCheckBox]] • [[TDBRadioGroup]] • [[TDBCalendar]] • [[TDBGroupBox]] • [[TDBGrid]] • [[TDBDateTimePicker]] | |
| 64 | + | [[Data Access tab|Data Access]] | [[TDataSource]] • [[TCSVDataSet]] • [[TSdfDataSet]] • [[TBufDataset]] • [[TFixedFormatDataSet]] • [[TDbf]] • [[TMemDataset]] | |
| 65 | + | [[System tab|System]] | [[TTimer]] • [[TIdleTimer]] • [[TLazComponentQueue]] • [[THTMLHelpDatabase]] • [[THTMLBrowserHelpViewer]] • [[TAsyncProcess]] • [[TProcessUTF8]] • [[TProcess]] • [[TSimpleIPCClient]] • [[TSimpleIPCServer]] • [[TXMLConfig]] • [[TEventLog]] • [[TServiceManager]] • [[TCHMHelpDatabase]] • [[TLHelpConnector]] | |
| 66 | + | [[Misc tab|Misc]] | [[TColorButton]] • [[TSpinEdit]] • [[TFloatSpinEdit]] • [[TArrow]] • [[TCalendar]] • [[TEditButton]] • [[TFileNameEdit]] • [[TDirectoryEdit]] • [[TDateEdit]] • [[TTimeEdit]] • [[TCalcEdit]] • [[TFileListBox]] • [[TFilterComboBox]] • [[TComboBoxEx]] • [[TCheckComboBox]] • [[TButtonPanel]] • [[TShellTreeView]] • [[TShellListView]] • [[TXMLPropStorage]] • [[TINIPropStorage]] • [[TJSONPropStorage]] • [[TIDEDialogLayoutStorage]] • [[TMRUManager]] • [[TStrHolder]] | |
| 67 | + | [[LazControls tab|LazControls]] | [[TCheckBoxThemed]] • [[TDividerBevel]] • [[TExtendedNotebook]] • [[TListFilterEdit]] • [[TListViewFilterEdit]] • [[TLvlGraphControl]] • [[TShortPathEdit]] • [[TSpinEditEx]] • [[TFloatSpinEditEx]] • [[TTreeFilterEdit]] • [[TExtendedTabControl]] • | |
| 68 | + | [[RTTI tab|RTTI]] | [[TTIEdit]] • [[TTIComboBox]] • [[TTIButton]] • [[TTICheckBox]] • [[TTILabel]] • [[TTIGroupBox]] • [[TTIRadioGroup]] • [[TTICheckGroup]] • [[TTICheckListBox]] • [[TTIListBox]] • [[TTIMemo]] • [[TTICalendar]] • [[TTIImage]] • [[TTIFloatSpinEdit]] • [[TTISpinEdit]] • [[TTITrackBar]] • [[TTIProgressBar]] • [[TTIMaskEdit]] • [[TTIColorButton]] • [[TMultiPropertyLink]] • [[TTIPropertyGrid]] • [[TTIGrid]] | |
| 69 | + | [[SQLdb tab|SQLdb]] | [[TSQLQuery]] • [[TSQLTransaction]] • [[TSQLScript]] • [[TSQLConnector]] • [[TMSSQLConnection]] • [[TSybaseConnection]] • [[TPQConnection]] • [[TPQTEventMonitor]] • [[TOracleConnection]] • [[TODBCConnection]] • [[TMySQL40Connection]] • [[TMySQL41Connection]] • [[TMySQL50Connection]] • [[TMySQL51Connection]] • [[TMySQL55Connection]] • [[TMySQL56Connection]] • [[TMySQL57Connection]] • [[TSQLite3Connection]] • [[TIBConnection]] • [[TFBAdmin]] • [[TFBEventMonitor]] • [[TSQLDBLibraryLoader]] | |
| 70 | + | [[Pascal Script tab|Pascal Script]] | [[TPSScript]] • [[TPSScriptDebugger]] • [[TPSDllPlugin]] • [[TPSImport Classes]] • [[TPSImport DateUtils]] • [[TPSImport ComObj]] • [[TPSImport DB]] • [[TPSImport Forms]] • [[TPSImport Controls]] • [[TPSImport StdCtrls]] • [[TPSCustomPlugin]] | |
| 71 | + | [[SynEdit tab|SynEdit]] | [[TSynEdit]] • [[TSynCompletion]] • [[TSynAutoComplete]] • [[TSynMacroRecorder]] • [[TSynExporterHTML]] • [[TSynPluginSyncroEdit]] • [[TSynPasSyn]] • [[TSynFreePascalSyn]] • [[TSynCppSyn]] • [[TSynJavaSyn]] • [[TSynPerlSyn]] • [[TSynHTMLSyn]] • [[TSynXMLSyn]] • [[TSynLFMSyn]] • [[TSynDiffSyn]] • [[TSynUNIXShellScriptSyn]] • [[TSynCssSyn]] • [[TSynPHPSyn]] • [[TSynTeXSyn]] • [[TSynSQLSyn]] • [[TSynPythonSyn]] • [[TSynVBSyn]] • [[TSynAnySyn]] • [[TSynMultiSyn]] • [[TSynBatSyn]] • [[TSynIniSyn]] • [[TSynPoSyn]] | |
| 72 | + | [[Chart tab|Chart]] | [[TChart]] • [[TListChartSource]] • [[TRandomChartSource]] • [[TUserDefinedChartSource]] • [[TCalculatedChartSource]] • [[TDbChartSource]] • [[TChartToolset]] • [[TChartAxisTransformations]] • [[TChartStyles]] • [[TChartLegendPanel]] • [[TChartNavScrollBar]] • [[TChartNavPanel]] • [[TIntervalChartSource]] • [[TDateTimeIntervalChartSource]] • [[TChartListBox]] • [[TChartExtentLink]] • [[TChartImageList]] | |
| 73 | + | [[IPro tab|IPro]] | [[TIpFileDataProvider]] • [[TIpHtmlDataProvider]] • [[TIpHttpDataProvider]] • [[TIpHtmlPanel]] | |
| 74 | + | [[Virtual Controls tab|Virtual Controls]] | [[TVirtualDrawTree]] • [[TVirtualStringTree]] • [[TVTHeaderPopupMenu]] | |
| 43 | 75 | ||
| 44 | 76 | --- | |
| 45 | - | ||
| 77 | + | *From the Free Pascal wiki, page "TPairSplitter", as the Internet Archive kept it on 2025-06-16, last changed on 2024-11-17. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
