Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to combine two splitters?

Posted on 2010-08-16
12
Medium Priority
?
388 Views
Last Modified: 2012-05-10
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
Comment
Question by:zordes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
12 Comments
 
LVL 25

Expert Comment

by:epasquier
ID: 33452158
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
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 1200 total points
ID: 33452178
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
 
LVL 25

Expert Comment

by:epasquier
ID: 33452180
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 33452191
to remove the borders of the panel set the following property:

Bevelouter := bvNone
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 33452383
>>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
 

Author Comment

by:zordes
ID: 33452504
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
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 33452538
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
 
LVL 25

Assisted Solution

by:epasquier
epasquier earned 800 total points
ID: 33452735
@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
 

Author Comment

by:zordes
ID: 33452844
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
 
LVL 25

Expert Comment

by:epasquier
ID: 33453209
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
 

Author Closing Comment

by:zordes
ID: 33461671
The Geert solution was very easy to follow and the epasquier explanation helps to understand.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question