Silverfrost Logo About Us | Contact Us
 

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

%ob 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 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. 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 can be followed by options enclosed in square brackets. The options are:

named_c

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

named_l

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

named_r

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

no_border

Creates an invisible box which is useful for grouping controls.

panelled

Creates a three-dimensional panel.

shaded

Equivalent to %`ob.

status

The box takes the form of a status bar.

thin_panelled

An alternative to panelled.

scored

Double line, three-dimensional shade effect.

depressed

Single line, three-dimensional shade effect.

raised

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 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:

      WINAPP
      INTEGER i,winio@
      i=winio@('%ca[Named boxes]%bg[grey]&')
      i=winio@('%ob[named_l][Left]&')
      i=winio@('%nl         Box 1%cb&')
      i=winio@('%ob[named_c][Centre]&')
      i=winio@('%nl         Box 2%cb&')
      i=winio@('%ob[named_r][Right]&')
      i=winio@('%nl         Box 3%cb')
      END

%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 (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:

   WINAPP
   CHARACTER*17 str
   DOUBLE PRECISION val,min,max
   INTEGER i,winio@
   val=1.0
   min=1.0
   max=10.0
   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)
   i=winio@('%2.1ob[status,thin_panelled]&')
   i=winio@('%`4rf%cb&',val)
   i=winio@('%`rs%cb',str)
   END

%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@('%2.1ob[no_border]%dy&',0.5D0)
i=winio@('Two buttons placed   %nlto the right of text.%cb&')
i=winio@('%tt[OK]%nl%dy%tt[Cancel]%cb',0.3D0)

Notice that %dy 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.

 

 

Copyright © 1999-2017 Silverfrost Limited