[Solved] Tsplitter Example with 2 panels and MinSize lazarus / 10-Designer ---------------------------------------------------------------------- Mujie · 2010-06-27 18:06 Hi, Does anybody here have an example of how to use TSplitter with 2 panels ? I have been successful to resize a left panel with TSplitter1.MinSize, but failed for a right panel. How to prevent resize the right panel's with a TSplitter and with a specify width (MinSize) ? I don't want use a TPairSplitter. Thanks for your kindness sir.. ---------------------------------------------------------------------- theo · 2010-06-27 21:50 Each panel has its own "constraints" property. ---------------------------------------------------------------------- Mujie · 2010-06-28 04:09 Please attach some example project or paste some code if you don't mind, I'm still confused  .Thank you.... ---------------------------------------------------------------------- theo · 2010-06-28 06:08 Constraints.MinSize is a property of each TControl. See Object Inspector. If this is not what you want, then maybe you should rephrase your question. ---------------------------------------------------------------------- Mujie · 2010-06-28 06:44 Sorry, maybe I had a little trouble for expressing my question. I had to change it so that the second panel's width is limited, but although I had to change anyway with "Constraints.MinSize", the second panel's right border was always moving to the right until exit from main form. ---------------------------------------------------------------------- JuhaManninen · 2010-06-28 08:35 Use Align and Anchors instead of Constraints to stop the panel from moving. A good and easy way is to set left panel's Align=alLeft, splitter's Align=alLeft and right panel's Align=alClient. There is also anchor editor for more advanced layouts. Juha ---------------------------------------------------------------------- Mujie · 2010-06-28 14:06 Cool... its solved now, many thanks for Juha and Theo  . Now, below are the steps for anyone who may have difficulties in the use of these components : 1. Create a new project. 2. Drag a new two panels to the main form. 3. Set each Contraints MinSize panel's properties from Object Inspector, eg "50". 4. Drag a new TSplitter from Additional pallete component (right tab from Standar component). 5. Set Panel1 align properties to "alLeft", Panel2 align to "alClient", and Splitter1 to "alLeft". 6. Double click Form1 "Oncreate" events (still from Object Inspector), and fill the space with this code (optional) : Code: [Select]  Splitter1.Left := Panel1.Width;   Panel2.Left := Splitter1.Left + Splitter1.Width; 7. Finish, run your project. I love Lazarus and this forum ---------------------------------------------------------------------- JuhaManninen · 2010-06-28 21:20 Quote from: Mujie on June 28, 2010, 04:06:46 pm5. Set Panel1 align properties to "alLeft", Panel2 align to "alClient", and Splitter1 to "alLeft". 6. Double click Form1 "Oncreate" events (still from Object Inspector), and fill the space with this code (optional) : Code: [Select]  Splitter1.Left := Panel1.Width;   Panel2.Left := Splitter1.Left + Splitter1.Width; It is much simpler than what you explained. If you set the Align properties in the order I gave (left panel, splitter, right panel), starting from the initial Align=alNone, you don't need the step 6. All the layout changes happen already at design time so it is really WYSIWYG. Please play also with the anchor editor. Delphi doesn't have such thing and it took me some time to even notice it exists. Juha ---------------------------------------------------------------------- Kaller · 2012-08-19 06:29 The standard recipe setting the align of the panels has a fault, the alclient aligned panel will not fully "close". It loooks as if an autosnap was anticipated but not implemented, the spliiter comes up short and wont fully minimise that panel.  So I carefully set up a splitter using just the anchor editor (its kinda cool once you figure it out) and I got it working. But also I had to set the MinSize of the splitter to 1. Go figure. ---------------------------------------------------------------------- eny · 2012-08-19 08:05 Quote from: Kaller on August 19, 2012, 08:29:28 amThe standard recipe setting the align of the panels has a fault, And you are also using version 0.9.29 which was the stable Lazarus version in 2010, the year of this more than 2 year old topic??? ---------------------------------------------------------------------- Kaller · 2012-09-06 05:27 I always install the latest and greatest. The splitter wont close to the left either when you reverse the alignments.