GRIDPLUS - Line
Home Reference Manpage Examples Download License Contact

GRIDPLUS Line

The "Line" widget is something I created for GRIDPLUS. It can be used to create a horizontal -or- vertical line. Horizontal lines may have an optional title (label).

Example

This section contains an example which illustrates the main GRIDPLUS line command mode features.

The following example assumes that the reader is familiar with the contents of the Grid/Layout page. Information given on that page will not be duplicated here.

Note: The example assumes that the GRIDPLUS package has already been "required" and the commands imported.


Line Example 1

Window:

Source Code:

gridplus grid .mygrid1 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus line .myline

gridplus grid .mygrid2 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus layout .main -title "Line Example" {
   .mygrid1
   .myline:ew
   .mygrid2
}

pack .main

Comments:

The direction of the line (horizontal/vertical) is determinted by the attachment specified for the line in its containing Layout.

For Example: ".myline:ew"

In this case line ".myline" is attached to the east and west. The line is therefore stretched horizontally to fill its containing cell in the layout.


Line Example 2

Window:

Source Code:

gridplus grid .mygrid1 {
   {"Label One"}
   {"Label Two"}
   {"Label Three"}
   {"Label Four"}
   {"Label Five"}
}

gridplus line .myline

gridplus grid .mygrid2 {
   {"Label One"}
   {"Label Two"}
   {"Label Three"}
   {"Label Four"}
   {"Label Five"}
}

gridplus layout .main -title "Line Example" {
   .mygrid1 .myline:ns .mygrid2
}

pack .main

Comments:

The GRIDPLUS line command does not have any form of layout.

The direction of the line (horizontal/vertical) is determinted by the attachment specified for the line in its containing Layout.

For Example: ".myline:ns"

In this case line ".myline" is attached to the north (top) and south (Bottom). The Line is therefore stretched vertically to fill its containing cell in the layout.


Line Example 3

Window:

Source Code:

gridplus grid .mygrid1 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus line .myline -title "My Line"

gridplus grid .mygrid2 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus layout .main -title "Line Example" {
   .mygrid1
   .myline:ew
   .mygrid2
}

pack .main

Comments:

Horizontal lines may also have a title.

For Example: "gridplus line .myline -title "My Line""

This creates a Line with a title (label) "My Line".


Line Example 4

Window:

Source Code:


gridplus grid .mygrid1 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus grid .mygrid2 {
   {"Label One"} {"Label Two"} {"Label Three"} {"Label Four"} {"Label Five"}
}

gridplus line .myline -borderwidth 0 -background red

gridplus layout .main -title "Line Example" {
   .mygrid1
   .myline:ew
   .mygrid2
}

pack .main

Comments:

This example demontrates creating colored lines. To create a colored line set "-borderwidth 0" and the "-background" option to the required color. The "-linewidth" option can be used to control the width of the line.


Copyright © 2004
Adrian Davis.