The [winPane] command.
Introduction
The winPane command lets you create and manipulate subpanes in
Alpha's document windows.
It is possible to split a window vertically or horizontally
in as many subpanes as desired. The process of splitting is controlled at
two levels:
- in the graphical interface, there is a Splitting popup menu
located beside the Marks popup menu;
- programmatically, the [winPane] command lets you create, select or
close subpanes.
There is always only one currently active pane. Clicking on any pane makes
it current.
Synopsis
The formal syntax of the [winPane] command is:
winPane subcommand ?options? |
The possible subcommands are described below. Depending on the
subcommand, some options may be specified.
WinPane subcommands
In the following subcommands, panes are designated by their index in the
panes list. This index is not permanent and can change as panes are added
or removed. The index is 0-based, so the first pane is at index 0. If the
specified index is out of range, the commands raise an error.
The [close] subcommand
This command lets you close the pane corresponding to the
specified index. The syntax is:
winPane close ?-w win? ?index?
If no index is specified, the command applies to the currently selected
pane. If the pane which is closed was the current one, then the other pane
which was part of the split view becomes current.
The command returns the index of the current pane.
The [count] subcommand
This command returns the number of subpanes of a document window. This
provides a way of testing if a window is split: if it is not, the count is
equal to 1. The syntax is:
winPane count ?-w win?
Note: checking if a window is split can also be done using the
[getWinInfo] command with the split key (the returned boolean
value is equal to 1 if the window is split, 0 otherwise).
The [current] subcommand
This command can take two forms:
winPane current ?-w win?
winPane current ?-w win? index
In the first form, the command returns the index of the currently selected
pane. This is the same value returned by the [getWinInfo] command
with the paneNum key.
In the second form, the pane at the specified index is made current.
The [frame] subcommand
This command lets you get the frame of the pane corresponding to the
specified index in window coordinates. The syntax is:
winPane frame ?-w win? ?index?
If no index is specified, the command applies to the currently selected
pane.
The command returns a four elements list containing the origin's
coordinates and the width and height of the designated pane.
The [next] subcommand
This command lets you select the next pane. This is circular: if the
current pane is the last one in the panes list then the command selects the
first one in the list. The syntax is:
winPane next ?-w win?
It returns the index of the newly selected pane.
The [previous] subcommand
This command lets you select the previous pane. This is circular: if the
current pane is the first one then the command selects the last one. The
syntax is:
winPane previous ?-w win?
It returns the index of the newly selected pane.
The [refresh] subcommand
This command performs an immediate redraw of the pane corresponding to the
specified index. The syntax is:
winPane refresh ?-w win? ?index?
If no index is specified, the command applies to the current pane.
The [split] subcommand
This command lets you split the current pane into two subpanes. The
subdivision can be performed horizontally (resulting in stacked subpanes)
or vertically (subpanes side-by-side). The syntax is:
winPane split ?-w win? ?(horizontally|vertically)?
If the last argument is not specified, the pane is split vertically by
default.
The command returns the index of the current pane.
Examples
Here are a few basic examples which can be executed one by one in the Tcl Shell (⌘Y
) in
Alpha:
Welcome to Alpha's AlphaTcl shell.
«» set win $PREFS/prefs.tcl
«» edit $win
«» winPane -w $win split
«» winPane -w $win current 1
«» winPane -w $win split horizontally
«» winPane -w $win count
3
«» winPane -w $win next
2
«» winPane -w $win next
0
«» winPane -w $win close
«» winPane -w $win count
2
Last updated 2020-01-07 11:38:37