Box format - %n.mob[options][title]

In this section:

%ob (Open Box) is used to create boxes, to create a status bar, or to create a grid. Any of these can be filled with text and controls. %ob (Open Box) defines the top left hand corner of a rectangular box. Subsequent items are placed to the right and beneath this point until the box is closed with %cb (Close Box). Every open box must be closed before the format string (plus any continuations) is complete. Boxes can be nested, one within another, in order to provide a fine control over the positioning of items in a window. A grave accent is used to indicate that the box and all items within it should have a darker (shaded) background.

%ob (Open Box) can be followed by options enclosed in square brackets. The options are:


Places a given title in the top line of the box (in the centre)


Places a given title in the top line of the box (on the left).


Places a given title in the top line of the box (on the right)


Creates an invisible box which is useful for grouping controls.


Creates a three-dimensional panel.


Equivalent to %`ob.


The box takes the form of a status bar.


An alternative to panelled.


Double line, three-dimensional shade effect.


Single line, three-dimensional shade effect.


Single line, three-dimensional shade effect

A status bar is a strip (with the same colour as the face of a standard button) that is placed at the bottom of a window. A status bar is typically used to display help information. The status bar format should be used at the beginning of the first (normally the only) line of status information. For example, %ob[status]%he%cb would create a status bar and place help information in it. Although status bars can be made to cover more than one line (for example by using %he (Help Location) in a window in which some of the help strings extend over more than one line), the result tends to look ugly. No further controls should be specified after the final %cb that closes a status bar, unless they are positioned via a %ap format code (see Absolute position format - %ap).

A name that is to be placed in the top line of the box is provided as a standard character string. For example:

      INTEGER i,winio@
      i=winio@('%ca[Named boxes]%bg[grey]&')
      i=winio@('%nl         Box 1%cb&')
      i=winio@('%nl         Box 2%cb&')
      i=winio@('%nl         Box 3%cb')

%ob can take integer modifiers in order to create a grid. For example, %2.3ob would create a grid two items across and three down. The contents of each grid component are terminated with %cb. Thus the above case would require six %cb format codes following it to close each component of the grid.

Note that, if you place %rd (Edit Integer) (say) in the grid, you might also choose to use %co[no_data_border] in order to remove the border from the %rd control.

Most of the %ob options may be uesd when %ob is used to create a grid. However, a grid box cannot be named.

For example:

   CHARACTER*17 str
   DOUBLE PRECISION val,min,max
   INTEGER i,winio@
   str='Salford Software'
   i=winio@('%ww[no_frame]%ca[multiple regions]&')
c---Define a 2x2 box---
   i=winio@('%2.2ob[panelled] %7bt[one] %cb&')
   i=winio@(' %7bt[two] %cb&')
   i=winio@(' %7bt[three] %cb&')
c---Ddefine a slider ---
   i=winio@('%10sl[horizontal] %cb%nl&',val,min,max)

%ob can be used with the option no_border to divide a window into a rectangular array of sub regions that are used to position text and controls within each region. As a simple example, suppose we wish to place two buttons (one below the other) to the right of some text. Here is some code that has the desired effect.

i=winio@('Two buttons placed   %nlto the right of text.%cb&')

Notice that %dy (Vertical Displacement) has been used to provide vertical displacement. In this context, if the single argument for %dy were given the value 1.0D0 then the use of %dy would be equivalent to %nl (Newline).



Copyright © 1999-2024 Silverfrost Limited