class Callout
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
extended by TextCallout
A pop-up container that points at (or calls out) a specific region of the application (typically a specific control that triggered it).
In the following example, a callout displaying a Label
is shown when a
Button
is triggered:
function button_triggerHandler(event:TriggerEvent):Void {
var button = cast(event.currentTarget, Button);
var label = new Label();
label.text = "Hello World!";
Callout.show(label, button);
}
button.addEventListener(TriggerEvent.TRIGGER, button_triggerHandler);
1.0.0
.See also:
Static methods
staticshow(content:DisplayObject, origin:DisplayObject, ?supportedPositions:RelativePositions, modal:Bool = true, ?customOverlayFactory:() ‑> DisplayObject):Callout
Creates a callout, and then positions and sizes it automatically based based on an origin component and an optional set of positions.
In the following example, a callout displaying a Label
is shown when
a Button
is triggered:
function button_triggerHandler(event:TriggerEvent):Void {
var button = cast(event.currentTarget, Button);
var label = new Label();
label.text = "Hello World!";
Callout.show(label, button);
}
button.addEventListener(TriggerEvent.TRIGGER, button_triggerHandler);
1.0.0
.Constructor
new()
Creates a new Callout
object.
In general, a Callout
shouldn't be instantiated directly with the
constructor. Instead, use the static function Callout.show()
to create
a Callout
, as this often requires less pop-up management code.
1.0.0
.See also:
Variables
arrowPosition:RelativePosition
The edge of the callout where the arrow is positioned.
When calling Callout.show()
, the arrowPosition
property will be
managed automatically and should not be modified.
1.0.0
.backgroundSkin:DisplayObject
The primary background to display behind the callout's content.
In the following example, the callout's background is set to a bitmap:
callout.backgroundSkin = new Bitmap(bitmapData);
1.0.0
.content:DisplayObject
The display object that will be displayed by the callout.
This object may be resized to fit the callout's bounds. If the content
needs to be scrolled when placed into a smaller region than its ideal
size, it should be added to a ScrollContainer
, and the
ScrollContainer
should be passed in as the content.
In the following example, the callout's content is a bitmap:
callout.content = new Bitmap(bitmapData);
1.0.0
.See also:
gap:Float
The space, in pixels, between the callout and its origin.
In the following example, the callout's gap is set to 20 pixels:
callout.gap = 20.0;
1.0.0
.horizontalAlign:HorizontalAlign
The horizontal alignment of the callout, relative to the origin, if the callout is positioned on the top or bottom side of the origin.
The following example aligns the callout to the right:
callout.horizontalAlign = RIGHT;
Note: The HorizontalAlign.JUSTIFY
constant is not supported by this
component.
1.0.0
.See also:
marginBottom:Float
The minimum space, in pixels, between the callout and the stage's bottom edge.
In the following example, the callout's bottom margin is set to 20 pixels:
callout.marginBottom = 20.0;
1.0.0
.marginLeft:Float
The minimum space, in pixels, between the callout and the stage's left edge.
In the following example, the callout's left margin is set to 20 pixels:
callout.marginLeft = 20.0;
1.0.0
.marginRight:Float
The minimum space, in pixels, between the callout and the stage's right edge.
In the following example, the callout's right margin is set to 20 pixels:
callout.marginRight = 20.0;
1.0.0
.marginTop:Float
The minimum space, in pixels, between the callout and the stage's top edge.
In the following example, the callout's top margin is set to 20 pixels:
callout.marginTop = 20.0;
1.0.0
.origin:DisplayObject
A callout may be positioned relative to another display object, known as the origin. Even if the position of the origin changes, the callout will be re-positioned automatically to always point at the origin.
1.0.0
.See also:
paddingBottom:Float
The minimum space, in pixels, between the callout's bottom edge and the callout's content.
In the following example, the callout's bottom padding is set to 20 pixels:
callout.paddingBottom = 20.0;
1.0.0
.paddingLeft:Float
The minimum space, in pixels, between the callout's left edge and the callout's content.
In the following example, the callout's left padding is set to 20 pixels:
callout.paddingLeft = 20.0;
1.0.0
.paddingRight:Float
The minimum space, in pixels, between the callout's right edge and the button's content.
In the following example, the callout's right padding is set to 20 pixels:
callout.paddingRight = 20.0;
1.0.0
.paddingTop:Float
The minimum space, in pixels, between the callout's top edge and the callout's content.
In the following example, the callout's top padding is set to 20 pixels:
callout.paddingTop = 20.0;
1.0.0
.supportedPositions:Array<RelativePosition>
The set of positions that the callout may appear at, relative to its origin. Positioning of the callout is attempted in order, and if the callout does not fit between the origin and the edge of the stage, the next position is attempted. If the callout is too large for all positions, the position with the most space will be used.
1.0.0
.See also:
verticalAlign:VerticalAlign
The vertical alignment of the callout, relative to the origin, if the callout is positioned on the left or right side of the origin.
The following example aligns the callout to the top:
callout.verticalAlign = TOP;
Note: The VerticalAlign.JUSTIFY
constant is not supported by this
component.
1.0.0
.See also:
Methods
close():Void
Closes the callout, if opened.
When the callout closes, it will dispatch an event of type
Event.CLOSE
.
1.0.0
.See also:
openfl.events.Event.CLOSE