class PopUpDatePicker
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IStageFocusDelegate, IFocusObject, IDateSelector
Displays a control consisting of a TextInput
and Button
that allows a
date to be selected. When the button is triggered, a DatePicker
is
displayed as a pop-up.
The following example creates a pop-up date picker, sets the selected date, and listens for when the selection changes:
var datePicker = new PopUpDatePicker();
datePicker.selectedDate = new Date(2020, 1, 6);
datePicker.addEventListener(Event.CHANGE, (event:Event) -> {
var datePicker = cast(event.currentTarget, PopUpDatePicker);
trace("DatePicker changed: " + datePicker.selectedDate);
});
this.addChild(datePicker);
Events:
openfl.events.Event.CHANGE | Dispatched when
|
---|---|
openfl.events.Event.OPEN | Dispatched when the pop-up date picker is opened. |
openfl.events.Event.CLOSE | Dispatched when the pop-up date picker is closed. |
feathers.events.DatePickerEvent.ITEM_TRIGGER | Dispatched when the user taps or clicks an item renderer in the date picker. The pointer must remain within the bounds of the item renderer on release, or the gesture will be ignored. |
1.0.0
.See also:
Static variables
staticfinalread onlyCHILD_VARIANT_BUTTON:String = "popUpDatePicker_button"
The variant used to style the Button
child component in a theme.
To override this default variant, set the
PopUpDatePicker.customButtonVariant
property.
1.0.0
.See also:
staticfinalread onlyCHILD_VARIANT_DATE_PICKER:String = "popUpDatePicker_datePicker"
The variant used to style the DatePicker
child component in a theme.
To override this default variant, set the
PopUpDatePicker.customDatePickerVariant
property.
1.0.0
.See also:
staticfinalread onlyCHILD_VARIANT_TEXT_INPUT:String = "popUpDatePicker_textInput"
The variant used to style the TextInput
child component in a theme.
To override this default variant, set the
PopUpDatePicker.customTextInputVariant
property.
1.0.0
.See also:
Constructor
Variables
read onlyactualLocaleIDName:String
The locale ID name that is being used, which may be different from the requested locale ID name.
1.0.0
.See also:
buttonFactory:AbstractDisplayObjectFactory<Dynamic, Button>
Creates the button, which must be of type feathers.controls.Button
.
In the following example, a custom button factory is provided:
datePicker.buttonFactory = () ->
{
return new Button();
};
1.0.0
.See also:
customButtonVariant:String
A custom variant to set on the button, instead of
PopUpDatePicker.CHILD_VARIANT_BUTTON
.
The customButtonVariant
will be not be used if the result of
buttonFactory
already has a variant set.
1.0.0
.See also:
customDatePickerVariant:String
A custom variant to set on the pop-up date picker, instead of
PopUpDatePicker.CHILD_VARIANT_DATE_PICKER
.
The customDatePickerVariant
will be not be used if the result of
datePickerFactory
already has a variant set.
1.0.0
.See also:
customMonthNames:Array<String>
A custom set of month names to use instead of the default.
1.0.0
.customStartOfWeek:Null<Int>
The index of the day that starts each week. 0
is Sunday and 6
is
Saturday. Set to null
to use the default.
1.0.0
.customTextInputVariant:String
A custom variant to set on the text input, instead of
PopUpDatePicker.CHILD_VARIANT_TEXT_INPUT
.
The customTextInputVariant
will be not be used if the result of
textInputFactory
already has a variant set.
1.0.0
.See also:
customWeekdayNames:Array<String>
A custom set of weekday names to use instead of the default.
1.0.0
.datePickerFactory:AbstractDisplayObjectFactory<Dynamic, DatePicker>
Creates the date picker that is displayed as a pop-up. The date picker
must be of type feathers.controls.DatePicker
.
Note: The following properties should not be set in the
datePickerFactory
because they will be overridden by the
PopUpDatePicker
when it validates.
DatePicker.requestedLocaleIDName
DatePicker.displayedMonth
DatePicker.displayedFullYear
DatePicker.selectedDate
DatePicker.customMonthNames
;DatePicker.customWeekdayNames
DatePicker.customStartOfWeek
In the following example, a custom date picker factory is provided:
datePicker.datePickerFactory = () ->
{
return new DatePicker();
};
1.0.0
.See also:
read onlyopen:Bool
Indicates if the pop-up date picker is open or closed.
1.0.0
.See also:
openDatePickerOnFocus:Bool = false
Determines if the pop-up date picker should automatically open when the date picker receives focus, or if the user is required to click the open button.
1.0.0
.popUpAdapter:IPopUpAdapter
Manages how the pop-up DatePicker
is displayed when it is opened and
closed.
In the following example, a custom pop-up adapter is provided:
popUpDatePicker.popUpAdapter = new DropDownPopUpAdapter();
1.0.0
.prompt:String
The text displayed by the text input when no date is selected.
The following example sets the date picker's prompt:
popUpDatePicker.prompt = "Select an item";
1.0.0
.textInputFactory:AbstractDisplayObjectFactory<Dynamic, TextInput>
Creates the text input, which must be of type feathers.controls.TextInput
.
In the following example, a custom text input factory is provided:
datePicker.textInputFactory = () ->
{
return new TextInput();
};
1.0.0
.See also:
Methods
closeDatePicker():Void
Closes the pop-up date picker, if it is open.
The following example closes the pop-up date picker:
if(datePicker.open)
{
datePicker.closeDatePicker();
}
When the pop-up date picker closes, the component will dispatch an event of
type Event.CLOSE
.
1.0.0
.See also:
openDatePicker():Void
Opens the pop-up date picker, if it is not already open.
The following example opens the pop-up date picker:
if(!datePicker.open)
{
datePicker.openDatePicker();
}
When the pop-up date picker opens, the component will dispatch an event
of type Event.OPEN
.
1.0.0
.See also: