User Tools

Site Tools


k18:k18.6:start

18.6 Splitter (gb.qt4)

Using the Splitter control requires more detailed preliminary considerations about the design of the form than if you just want to arrange some controls freely on a form. Once you have decided which containers you want to use and which controls are to be inserted into them, it is a good plan to record the arrangement in a suitable form. This is strongly recommended if you are developing a multiply nested form design with several containers of type Splitter:

BILD 1

Figure 18.6.1: Design with menu and two splitter controls (draft)

In the figure above, the individual containers are only coloured in the design view to make the design easier to recognise. In the following source code, essential properties of the form and the two control elements Splitter as well as the controls inserted in them are defined:

    [1] Public Sub Form_Open()
    [2]
    [3] '-- DESIGN
    [4] '-- The control `hsplitterMaster` completely fills the form in the container Form
    [5]     FMain.Arrangement = Arrange.Fill
    [6]     FMain.Margin = True
    [7]     FMain.Spacing = True
    [8]
    [9]     hsplitterMaster.Arrangement = Arrange.Horizontal
    [10]     hsplitterMaster.Layout = [20, 80]
    [11]     hsplitterMaster.Spacing = True
    [12]     hsplitterSecond.Arrangement = Arrange.Vertical
    [13]     hsplitterSecond.Layout = [70, 30]
    [14]     hsplitterSecond.Spacing = True
    [15]
    [16]     VBoxLeft.Margin = True
    [17]     VBoxLeft.Spacing = True
    [18]     DirView1.Expand = True
    [19]
    [20]     VBoxRight.Margin = True
    [21]     VBoxRight.Spacing = True
    [22]     HBoxBottom.Spacing = True
    [23]     ...
    [24]     gbttSettings = New Settings(User.Home &/ "GBTTT" &/ "gbtt.conf")
    [25]     gbttSettings.Read(Me, "Form")
    [26]     ...
    [27] End

Comment

  • Lines 9 and 10 specify that the splitter hsplitterMaster arranges its two containers VBoxLeft and VBoxRight next to each other (horizontally) and that the splitting ratio of the containers is 20%:80% when the programme starts.
  • Lines 12 and 13 specify that the splitter hsplitterSecond arranges its two containers TextArea and FileView below each other (vertically) and that the splitting ratio of the containers is 70%:30% when the programme starts.
  • Note that the container VBoxRight contains two controls: Splitter hsplitterSecond (with two controls) and the HBox HBoxBottom.

BILD 2

Figure 18.6.2: Arrangement of controls (runtime).

Notes

  • The HSplit and VSplit controls are containers that arrange the inserted controls horizontally or vertically respectively. They are described in the following chapter.
  • However, both controls are considered obsolete and can well be replaced by the container control Splitter.

Download

Projects

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k18/k18.6/start.txt · Last modified: 07.10.2023 by emma

Page Tools