Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

How to combine two splitters?

I would like to combine the two splitters, see attached picture of the screen.
How to arrange them?
I tried already, but I am always getting the horizontal splitter separating the whole screen in two halfs.

Thank You
Screen.jpg
0
zordes
Asked:
zordes
  • 4
  • 4
  • 3
2 Solutions
 
epasquierCommented:
you must use panels.

first put a panel with Align = all left, a splitter with AlLeft - both in the main form
then on the left aligned panel, you put your vertical splitter (with what you want to split)
0
 
Geert GruwezOracle dbaCommented:
you need to use panels for this

first step:
2 panels: 1st align alLeft, 2nd align alClient

second step:
on the left panel, add two more panels
1st align top, 2nd align client

then add the 2 splitters
you'll be dropping them on a panel
click on 1, press ctrl-X, hit esc until the form is selected, hit Ctrl-V, set align of the panel to alLeft

next click on the second splitter, hit Ctrl-X
click on one the panels left, then hit esc, to select the panel below
then hit Ctrl-V, set align of the splitter to alTop

you should have this dfm (right click on form, view as text)
object Form5: TForm5
  Left = 165
  Top = 144
  Caption = 'Form5'
  ClientHeight = 536
  ClientWidth = 971
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Splitter1: TSplitter
    Left = 249
    Top = 0
    Height = 536
    ExplicitLeft = 8
    ExplicitTop = 104
    ExplicitHeight = 100
  end
  object Panel1: TPanel
    Left = 252
    Top = 0
    Width = 719
    Height = 536
    Align = alClient
    Caption = 'Panel1'
    TabOrder = 0
    OnClick = Panel1Click
    ExplicitLeft = 352
    ExplicitTop = 48
    ExplicitWidth = 505
    ExplicitHeight = 417
  end
  object Panel2: TPanel
    Left = 0
    Top = 0
    Width = 249
    Height = 536
    Align = alLeft
    Caption = 'Panel2'
    TabOrder = 1
    ExplicitLeft = 48
    ExplicitTop = 72
    ExplicitHeight = 345
    object Splitter2: TSplitter
      Left = 1
      Top = 258
      Width = 247
      Height = 3
      Cursor = crVSplit
      Align = alTop
      ExplicitWidth = 277
    end
    object Panel3: TPanel
      Left = 1
      Top = 1
      Width = 247
      Height = 257
      Align = alTop
      Caption = 'Panel3'
      TabOrder = 0
      ExplicitLeft = 56
      ExplicitTop = 32
      ExplicitWidth = 177
    end
    object Panel4: TPanel
      Left = 1
      Top = 261
      Width = 247
      Height = 274
      Align = alClient
      Caption = 'Panel4'
      TabOrder = 1
      ExplicitLeft = 80
      ExplicitTop = 312
      ExplicitWidth = 185
      ExplicitHeight = 41
    end
  end
end

Open in new window

0
 
epasquierCommented:
Here is the code for this (.DFM file in code section) :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    pnl1: TPanel;
    spl1: TSplitter;
    mmo1: TMemo;
    mmo2: TMemo;
    spl2: TSplitter;
    mmo3: TMemo;
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

end.
object Form1: TForm1
  Left = -1508
  Top = 114
  Width = 483
  Height = 287
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object spl1: TSplitter
    Left = 185
    Top = 0
    Width = 4
    Height = 251
    Cursor = crHSplit
  end
  object pnl1: TPanel
    Left = 0
    Top = 0
    Width = 185
    Height = 251
    Align = alLeft
    Caption = 'pnl1'
    TabOrder = 0
    object spl2: TSplitter
      Left = 1
      Top = 90
      Width = 183
      Height = 4
      Cursor = crVSplit
      Align = alTop
    end
    object mmo2: TMemo
      Left = 1
      Top = 1
      Width = 183
      Height = 89
      Align = alTop
      Lines.Strings = (
        'mmo2')
      TabOrder = 0
    end
    object mmo3: TMemo
      Left = 1
      Top = 94
      Width = 183
      Height = 156
      Align = alClient
      Lines.Strings = (
        'mmo3')
      TabOrder = 1
    end
  end
  object mmo1: TMemo
    Left = 189
    Top = 0
    Width = 278
    Height = 251
    Align = alClient
    Lines.Strings = (
      'mmo1')
    TabOrder = 1
  end
end

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Geert GruwezOracle dbaCommented:
to remove the borders of the panel set the following property:

Bevelouter := bvNone
0
 
Geert GruwezOracle dbaCommented:
>>Please accept answers of both epasquier and me.
>>They answers are almost identical

both the panel and the splitter should be aligned alLeft.
They act as a pair having the same alignment

You can do this with the request attention button

The first splitter will grow/shrink the left panel (Panel2 in my sample)
The second splitter will grow/shrink the top panel (Panel3 in my sample)

Panel1 and Panel4 will then resize to take up the remaining space
0
 
zordesAuthor Commented:
Hallo Geert and epasquier

I do not know , that bot answers can be accepted. How to do this?
I accepted the solution of Geert Gruwez due to more detail and better explanation.
0
 
Geert GruwezOracle dbaCommented:
you can use the "Accept multiple solutions" link below a comment.
The next step involves selecting the other answers which also helped

>> http://www.experts-exchange.com/help.jsp#hs=29&hi=407

However, some days ago there was a bug with accepting multiple answers
I don't know if it's resolved yet
0
 
epasquierCommented:
@Zordes : I don't think my explanation is less complete by being shorter. It has all you need, and is the shortest way of doing this - but you must do it in the exact order :
1) on the main form : panel, splitter (all left aligned)
2) on the panel : top-left most component , splitter (all top aligned)
you put the all-client aligned components after

you could also do it with right-align or bottom aligned, if you put the non-all-client aligned components first (always before the splitter)

if you follow this simple rules, you don't need to cut/paste objects to their rightful position - you put them directly where and how they need to be.

if you did not put the objects in the correct place, or after need some layout change, then you can use Geert cut/paste technique. OR you move the components by drag-drop in the object tree view (from panel to main form or the other way, as needed), which is my prefered way of doing so.

@geert : I didn't knew that the escape key was ALWAYS selecting the parent component of the currently selected. I formerly believed that it was returning to the main form. That is the trick !
Usually when I face this situation and use cut/paste, I select the correct parent in the object tree view. I will try to remember that Escape can gain me a few seconds.

When I saw that we answered about at the same time, I knew that the chance for split accept (which is the way to close in these cases when both answers are right on - even if with slightly different techniques) was small. I appreciate your concern about this, but don't bother too much - it happens so often.

@zordes : if you want and can easily correct and by the way learn how to do split accept, do it. Otherwise, if you promise that you will give though to it next time you feel it is deserved, that will be enough for me.
0
 
zordesAuthor Commented:
Sorry  epasquier

I am new with delphi. The way desribed by geert was more straightforward for me.
I wolud like to split the points now, but I do not see how to do it,  for the closed question.

0
 
epasquierCommented:
As geert said, "You can do this with the request attention button" , for a moderator to reopen the question so that you might close it again according to your wishes.

But don't bother, except if you want to see how it's done
0
 
zordesAuthor Commented:
The Geert solution was very easy to follow and the epasquier explanation helps to understand.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now