课程表

Flex课程

工具箱
速查手册

Flex DateChooser控件

当前位置:免费教程 » 软件/图像 » Flex

介绍

DateChooser控件用于显示月份的名称,年份和月份的网格,其中列标有星期几。

DateChooser控件允许用户选择日期,日期范围或多个日期。 该控件包含用于更改月份和年份的前进和后退箭头按钮。

类声明

以下是 mx.controls.DateChooser 类的声明:

  1. public class DateChooser
  2. extends UIComponent
  3. implements IFocusManagerComponent, IFontContextComponent

公共财产

S.N.属性和描述
1

allowDisjointSelection:Boolean

如果为true,则指定在DateChooser控件中允许非连续(不相交)选择。

2

allowMultipleSelection:Boolean

如果为true,则指定在DateChooser控件中允许多个选择。

3

dayNames:Array

DateChooser控件的工作日名称。

4

disabledDays:Array

在一周内禁用的日期。

5

disabledRanges:Array

禁用单天和多天。

6

displayedMonth:int

与displayedYear属性一起使用,displayedMonth属性指定在DateChooser控件中显示的月份。

7

displayedYear:int

与displayedMonth属性一起使用,displayedYear属性指定在DateChooser控件中显示的年份。

8

firstDayOfWeek:Object

表示在DateChooser控件的第一列中显示的星期几的数字。

9

maxYear:int

最后一年可在控件中选择。

10

minYear:int

第一年可在控件中选择。

11

monthNames:Array

显示在DateChooser控件顶部的月份的名称。

12

monthSymbol:String

此属性附加到由monthNames属性指定的值的末尾,以定义显示在DateChooser控件顶部的月份的名称。

13

selectableRange:Object

可选择日期之间的日期范围。

14

selectedDate : Date

在DateChooser控件中选择的日期。

15

selectedRanges:Array

所选日期范围。

16

showToday:Boolean

如果为true,则指定今天在DateChooser控件中突出显示。

17

yearNavigationEnabled:Boolean

启用年度导航。

18

yearSymbol:String

此属性附加到显示在DateChooser控件顶部的年份末尾。

受保护的属性

S.N.属性和描述
1

calendarLayoutStyleFilters:Object

[只读]要从DateChooser传递到日历布局的一组样式。

2

nextMonthStyleFilters:Object

[只读]要从DateChooser传递到下一个月按钮的一组样式。

3

nextYearStyleFilters:Object

[只读]从DateChooser传递到下一年按钮的一组样式。

4

prevMonthStyleFilters:Object

[只读]从DateChooser传递到上个月按钮的样式集。

5

prevYearStyleFilters:Object

[只读]要从DateChooser传递到上一年按钮的一组样式。

公共方法

S.N.方法和描述
1

DateChooser()

构造函数。

事件

S.N.事件和描述
1

change

在选择或更改日期时分派。

2

scroll

由于用户互动而导致月份更改时分派。

继承的方法

此类继承以下类中的方法:

  • mx.core.UIComponent

  • mx.core.FlexSprite

  • flash.display.Sprite

  • flash.display.DisplayObjectContainer

  • flash.display.InteractiveObject

  • flash.display.DisplayObject

  • flash.events.EventDispatcher

  • Object

Flex DateChooser控件示例

让我们按照以下步骤通过创建测试应用程序来检查Flex应用程序中DateChooser控件的使用:

步骤描述
1 Flex - 创建应用程序章节中所述,在包 com.tutorialspoint.client 下创建名为 HelloWorld 的项目。
2修改 HelloWorld.mxml ,如下所述。 保持文件的其余部分不变。
3编译并运行应用程序,以确保业务逻辑按照要求工作。

以下是修改后的mxml文件 src / com.tutorialspoint / HelloWorld.mxml 的内容。

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:mx="library://ns.adobe.com/flex/mx"
  5. width="100%" height="100%" minWidth="500" minHeight="500"
  6. applicationComplete="application_applicationCompleteHandler(event)"
  7. >
  8.  
  9. <fx:Style source="/com/tutorialspoint/client/Style.css"/>
  10. <fx:Script>
  11. <![CDATA[
  12. import mx.events.CalendarLayoutChangeEvent;
  13. import mx.events.FlexEvent;
  14.  
  15. [Bindable]
  16. private var selectedDate:String = "";
  17. protected function dateChooser_changeHandler
  18. event:CalendarLayoutChangeEvent):void
  19. {
  20. var date:Date = DateChooser(event.target).selectedDate;
  21. selectedDate = dateFormatter.format(date);
  22. }
  23. protected function application_applicationCompleteHandler
  24. (event:FlexEvent):void
  25. {
  26. selectedDate = dateFormatter.format(new Date());
  27. }
  28. ]]>
  29. </fx:Script>
  30. <s:BorderContainer width="550" height="400" id="mainContainer"
  31. styleName="container">
  32. <s:VGroup width="100%" height="100%" gap="50"
  33. horizontalAlign="center" verticalAlign="middle">
  34. <s:Label id="lblHeader" text="Form Controls Demonstration"
  35. fontSize="40" color="0x777777" styleName="heading"/>
  36. <s:Panel id="dateChooserPanel" title="Using DateChooser" width="400"
  37. height="300" includeInLayout="true" visible="true">
  38. <s:layout>
  39. <s:HorizontalLayout gap="10" verticalAlign="middle"
  40. horizontalAlign="center"/>
  41. </s:layout>
  42. <mx:DateChooser id="dateChooser" yearNavigationEnabled="true"
  43. change="dateChooser_changeHandler(event)"/>
  44. <s:Label id="selection" fontWeight="bold"
  45. text="Date selected: {selectedDate}"/>
  46. </s:Panel>
  47. </s:VGroup>
  48. </s:BorderContainer>
  49. </s:Application>

准备好所有更改后,让我们以正常模式编译和运行应用程序,就像在 Flex - 创建应用程序中一样 章节。 如果一切顺利,您的应用程序,这将产生以下结果:[在线试用]

Flex DateChooser Control
转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号