Image button and image bar - %n.mib
%ib provides an enhanced and simplified replacement for %tb. Like %tb, %ib can
be used to create toolbars or rectangular arrays of image buttons. However,
only one flat image is required for each button - all the variants are created
automatically. Also, text can be automatically added to the image. Here is some
sample code that illustrates the use of %ib.
+ 'copy/Copy',4,'CONTINUE', 'paste/Paste',4,'CONTINUE')
cut BITMAP cut.bmp
copy BITMAP copy.bmp
paste BITMAP paste.bmp
The argument list for %ib consists of the following triplet repeated for each
button in turn: bitmap_name, stat_ctrl, cb_func.
The first part of the string bitmap_name gives the name of a bitmap
resource. If you want a string to be added to the bitmap then this must come
next after an oblique ('/'). This string can include linefeed characters
The integer stat_ctrl is used to control the state of the button. The
constant value 4 is used to describe a button that does not toggle, i.e. it is
in the down state only whilst the mouse button is held down. For a button that
toggles, use a variable that will take the value 1 when it is in the up state
and the value 2 when in the down state. The state value 3 describes a button
that is greyed and disabled. Every button has a call-back function cb_func.
The option flat gives a toolbar that is initially flat and grey. When the
mouse cursor is above a button, the image becomes coloured and the button is
raised or depressed depending on its state. When this option is not used the
old style of button is obtained.
%ib is designed for bitmaps that have a grey background. If the image has a
one-pixel border then the border colour is used as the background colour,
otherwise the background is assumed to be light grey (192,192,192). This colour
is translated into the current system COLOR_BTNFACE colour selected by the user
from the Control Panel. In the above example, the image bitmaps are
48x24 pixels. This results in buttons of equal width when the strings are
added. See %ib - Image Button for further details..