GRIDPLUS2 - Pane
Home Reference Manpage Examples Download License Contact

GRIDPLUS Pane

In order to simplify creation of screen layouts, GRIDPLUS provides a GRIDPLUS pane command mode. This is used to create a Paned Window.

Examples

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

The following example assumes that the reader is familiar with the contents of the Grid/Layout,Entry, Text, Tree and Resize pages. Information given on those pages will not be duplicated here.

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


Pane Example 1

Window:

Dragging the pane sash down displays the following window:-

Source Code:

gridplus text .mytext1 -width 40 -height 10 -title Text1
gridplus text .mytext2 -width 40 -height 10 -title Text2

gridplus pane .mypane -relief sunken {
   .mytext1
   .mytext2
}

gridplus layout .main -wtitle Pane {
   .mypane:nsew
}

pack .main

Comments:

Two GRIDPLUS text widgets are created: ".mytext1" and ".mytext2". Each of these is to be a pane.

A GRIDPLUS pane is created named ".mypane". The -relief option sets the pane frame style to "sunken".

The pane layout has a line for each pane. As the layout items are on separte lines a vertical orientation is selected.


Pane Example 2

Window:

Source Code:

gridplus text .mytext1 -width 40 -height 10 -title Text1
gridplus text .mytext2 -width 40 -height 10 -title Text2

gridplus pane .mypane -relief sunken {
   .mytext1 .mytext2
}

gridplus layout .main -wtitle Pane {
   .mypane:nsew
}

pack .main
Comments:

This example, similar to Example 1, demonstrates that specifying the pane layout items in a single line selects a horizontal orientation.


Pane Example 3

Window:

Resizing the window displays something like the following window:-

Source Code:

gridplus text .mytext -scroll y -width 40 -height 10
 
gridplus tree .mytree -scroll y -width 200 -open 1
 
gridplus entry .mygrid {
   {"Entry1" .entry1} {"Entry2" .entry2} {"Entry3" .entry3}
   {"Entry4" .entry4} {"Entry5" .entry5} {"Entry6" .entry6}
   {"Entry7" .entry7} {"Entry8" .entry8} {"Entry9" .entry9}
}
 
gridplus pane .mypane -title "My Pane" -width 400 {
   .mytext:
   .mytree:
   .mygrid
}
 
gridplus layout .main -wtitle Pane {
   .mypane:nsew
}
 
gridplus pack .main -resize xy
 
gpset .mytree {
   /File1
   {/Dir1 +}
   {/Dir1/Dir2 +}
   /Dir1/Dir2/File2
   /Dir1/Dir2/File3
   /Dir1/File4
   /Dir1/File5
   /File6
}

Comments:

This example demonstates the GRIDPLUS pane resizing options.

Three GRIDPLUS Widgets/Grids are created: ".mytext", ".mytree" and ".mygrid". Each of these Widgets/Grids is to be a pane.

By default, a pane will not resize in the direction of the pane orientation. Adding a colon (":") suffix to the layout for a pane will enable resizing. In this example the ".mytext" and ".mytree" widgets will resize, but ".mygrid" will not.

The GRIDPLUS Layout named ".main" stretches the Paned Window to fill its cell (".mypane:nsew"), the initial size of which (in this example) is controlled by the GRIDPLUS Widgets/Grids ".mytext", ".mytree" and ".mygrid".

As the window is to be resizable the GRIDPLUS pack command mode must be used (See Resize).


As an example of how the use of the resize option effects the look of the window when it is resized, the example below is the same as Example 3 but without the resize option suffix.

  gridplus pane .mypane -title "My Pane" -width 400 {
   .mytext
   .mytree
   .mygrid
}

When resized...


Copyright © 2013 Adrian Davis.