Widget Encyclopedia : WkImageWidget

WkImageWidget
WkImageWidgets provide a mechanism for displaying an image with an optional label. They call their default action callback when they are double clicked upon. The image and text labels may be layed out either vertically or horizontally. Different images and labels can be specified for the up state and the disabled state. An optional inset or outset border may also be specified.
Protocol
alignment: resourceValue
Sets the horizontal alignment for the widget's image.
 
horizontalAlignment: anInteger
Specifies the horizontal alignment for the widget's image.
Default: XmALIGNMENTBEGINNING (Left)
Valid resource values:
XmALIGNMENTBEGINNING (Left) - Causes the center of the image to be horizontally aligned with the left edge of the widget's window.
XmALIGNMENTCENTER (Center) - Causes the center of the image to be horizontally aligned in the center of the widget's window.
XmALIGNMENTEND (Right) - Causes the center of the image to be horizontally aligned with the right edge of the widget's window.
 
image: anImage
Set the image of the receiver.
 
labelInsensitivePixmap: anImage
Specifies the renderable object (image) which draws on the face of the widget when it is disabled.
 
labelInsensitiveString: aString
Specifies the renderable object (string) which draws on the face of the widget when it is disabled.
 
labelPixmap: anImage
Specifies the renderable object (image) which draws on the face of the widget.
 
labelString: aString
Specifies the renderable object (string) which draws on the face of the widget.
 
mnemonic: aCharacter
Provides the user with alternate means for selecting a button.
orientation: anInteger
Specifies whether the image and label are displayed vertically or horizontally.
Default: XmHORIZONTAL (Horizontal)
Valid resource values:
XmVERTICAL (Vertical) - Displays the image and label vertically.
XmHORIZONTAL (Horizontal) - Displays the image and label horizontally.
 
shadowType: anInteger
Specifies the drawing style for the frame around the label.
Default: XmSHADOWNONE (None)
Valid resource values:
XmSHADOWNONE (None) - No frame is drawn around the label.
XmSHADOWIN (In) - A frame is drawn that it appears inset. This means that the bottom shadow visuals and top shadow visuals are reversed.
XmSHADOWOUT (Out) - A frame is drawn that appears outset.
 
verticalAlignment: anInteger
Specifies the vertical alignment for the widget's image.
Default: XmALIGNMENTCENTER (Center)
Valid resource values:
XmALIGNMENTCENTER (Center) - Causes the center of the image to be vertically aligned in the center of the widget's window.
XmALIGNMENTTOP (Top) - Causes the top edge of the image to be vertically aligned with the top edge of the widget's window.
XmALIGNMENTBOTTOM (Bottom) - Causes the center of the image to be vertically aligned in the center of the widget's window.
Callbacks & Events
Default Action Callback
These callbacks are triggered when the widget is double clicked.
Editor
Border Width
Specifies the width of the border that surrounds the widget’s window on all four sides. The width is specified in pixels. A width of zero means that no border will show.
Border - Causes the widget to have a border.
No Border - Causes the widget to have no border.
 
Enabled
Determines whether a widget will react to input events. Disabled (insensitive) widgets do not react to input events.
 
Horizontal Alignment
Specifies the horizontal alignment for the widget's image.
Left - Causes the center of the image to be horizontally aligned with the left edge of the widget's window.
Center - Causes the center of the image to be horizontally aligned in the center of the widget's window.
Right - Causes the center of the image to be horizontally aligned with the right edge of the widget's window.
 
Label - Default
Specifies the default label string.
 
Label - Disabled
Specifies the label string when the widget is disabled.
 
Image - Default
Specifies the default label image.
 
Image - Disabled
Specifies the label image when the widget is disabled.
 
Mnemonic
Provides the user with alternate means for selecting a button.
 
Orientation
Specifies whether the image and label are displayed vertically or horizontally.
Vertical - Displays the image and label vertically.
Horizontal - Displays the image and label horizontally.
 
Shadow Type
Specifies the drawing style for the frame around the label.
None - No frame is drawn around the label.
In - A frame is drawn that it appears inset. This means that the bottom shadow visuals and top shadow visuals are reversed.
Out - A frame is drawn that appears outset.
 
Vertical Alignment
Specifies the vertical alignment for the widget's image.
Center - Causes the center of the image to be vertically aligned in the center of the widget's window.
Top - Causes the top edge of the image to be vertically aligned with the top edge of the widget's window.
Bottom - Causes the center of the image to be vertically aligned in the center of the widget's window.
 
Visible
Maps the widget (makes visible) as soon as it is both realized and managed, if set to True. If set to False, the client is responsible for mapping and unmapping the widget.
Example
The following example code creates a WkImageWidget where the image is composed of an icon (from a file) and a text label laid out vertically. This corresponds to the upper left image at the start of the WkImageWidget section.
aWkImageWidget := WkImageWidget
createWidget: 'aWkImageWidget'
parent: self form
argBlock: [:w | w
x: 52;
y: 44;
width: 136;
height: 80;
image: (WbLabeledImage stateDriven
image: (WbIcon fromFile: 'BALLOON.ICO')
label: 'Balloon';
orientation: XmVERTICAL;
yourself);
scale].
The next example code creates a WkImageWidget where the image is composed of an icon (from a file) and a text label laid out horizontally with an outset shadow type. This corresponds to the lower right image at the start of the WkImageWidget section.
aWkImageWidget := WkImageWidget
createWidget: 'aWkImageWidget'
parent: self form
argBlock: [:w | w
x: 52;
y: 44;
width: 136;
height: 80;
image: (WbLabeledImage stateDriven
image: (WbIcon fromFile: 'BALLOON.ICO')
label: 'Balloon';
yourself);
orientation: XmHORIZONTAL;
shadowType: XmSHADOWOUT;
scale].