Using IlvMessageLabel
The class
IlvMessageLabel displays a message, which can be accompanied by a bitmap. Messages are recorded in a database that can be associated with the current instance of
IlvDisplay.
The alignment of the message relative to the bitmap can be set to any position. In addition, it is possible to change the alignment of the whole block (message + bitmap) to IlvCenter, IlvLeft, or IlvRight in relation to its bounding box.
Figure 11.8 shows an example of an
IlvMessageLabel. The alignment of the message relative to the picture is
IlvBottom, and the global alignment of the
IlvMessageLabel is
IlvCenter.
Figure 11.8 A Message Label
This section covers the following topics:
Associating a Bitmap with a Message Label
Bitmaps can be associated with a message label using the member functions
IlvMessageLabel::setBitmap and
IlvMessageLabel::setInsensitiveBitmap.
setBitmap associates a main bitmap with the message label. setInsensitiveBitmap sets the bitmap that will be displayed when the message label is set to nonsensitive. If you do not provide a nonsensitive bitmap, a default one is automatically computed from the sensitive bitmap when setting the message label to nonsensitive.
Figure 11.9 Message Label with Sensitive and Nonsensitive Bitmap
Making the Message Label Opaque
Unlike the other gadgets, the message label is transparent by default. To make it opaque, call the member function
setTransparent with
IlFalse as its parameter. The bounding box of an opaque message label is filled with the background color that is set in the object palette.
Figure 11.10 An Opaque Message Label
Laying Out the Message Label
When a message label displays both a label and a bitmap, you can change the position of the label relative to the bitmap using the member function
IlvMessageLabel::setLabelPosition.
For example, to have the label appear to the left of the bitmap, call:
message->setLabelPosition(IlvLeft);
To set the spacing between the label and the bitmap to 20 pixels, call:
message->setSpacing(20);
To center the grouped label and the bitmap inside the bounding box of the message label, call:
message->setAlignment(IlvCenter);
Figure 11.11 Label and Bitmap Aligned as One Block
Localizing a Message Label
A message label can be localized.
Associating a Mnemonic
Message labels can include a mnemonic letter. When you press the key corresponding to the mnemonic letter with the modifier key (Alt on PCs or Meta on UNIX), or click the message label, the focus is given to the next gadget in the focus chain.
Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.