Attach DateChooser to PopUpButton : DateChooser « Components « Flex






Attach DateChooser to PopUpButton

Attach DateChooser to PopUpButton
       

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initPopupButton();" >

  <mx:Script>
    
      import mx.events.CalendarLayoutChangeEvent;
      import mx.controls.DateChooser;
      
      [Bindable]
      private var myDateChooser:DateChooser = new DateChooser();

      private function initPopupButton():void {
        myDateChooser.selectedDate = new Date();
        myDateChooser.addEventListener(CalendarLayoutChangeEvent.CHANGE, dateChangeHandler);
        myPopupButton.popUp = myDateChooser;
        myPopupButton.executeBindings(true);
      }

      private function dateChangeHandler(event:CalendarLayoutChangeEvent):void {
        myPopupButton.close();
      }

  
  </mx:Script>
    
  <mx:DateFormatter id="df" formatString="M/D/YYYY"/>
  
  <mx:Panel title="Using the PopUpButton Control" layout="horizontal">
      <mx:Label text="Select a date:"/>
      <mx:PopUpButton id="myPopupButton" label="{df.format(myDateChooser.selectedDate)}" width="135"/>
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Use DateChooser to choose dateUse DateChooser to choose date
2.DateChooser control with DateChooser control with <mx:DateChooser>
3.Access selectedDate from DateChooserAccess selectedDate from DateChooser
4.DateChooser header styleDateChooser header style
5.DateChooser Day styleDateChooser Day style
6.Set Today style for DateChooserSet Today style for DateChooser
7.DateChooser control selectableRange, disabledRanges, disabledDaysDateChooser control selectableRange, disabledRanges, disabledDays
8.Set dayNames of DateChooser with initialize eventSet dayNames of DateChooser with initialize event
9.Set firstDayOfWeek of DateChooser with initialize eventSet firstDayOfWeek of DateChooser with initialize event
10.Set headerColor of DateChooser with initialize eventSet headerColor of DateChooser with initialize event
11.Set selectableRange of DateChooser with initialize eventSet selectableRange of DateChooser with initialize event
12.DateChooser scrolling eventDateChooser scrolling event
13.Set DateChooser displaying MonthSet DateChooser displaying Month
14.Set date range for DateChooserSet date range for DateChooser
15.Add a DateChooser controlAdd a DateChooser control
16.Date entry with DateChooserDate entry with DateChooser
17.A DateChooser controlA DateChooser control
18.DateChooser StylesDateChooser Styles
19.DateChooser SelectableDateChooser Selectable
20.Set dayNames, firstDayOfWeek, headerColor, and selectableRange properties of a DateChooser control by using an initialize event:Set dayNames, firstDayOfWeek, headerColor, and selectableRange properties of a DateChooser control by using an initialize event:
21.Programmatic DateChooser SelectorProgrammatic DateChooser Selector
22.Get full year from selected dateGet full year from selected date
23.Set selectedDate property in a functionSet selectedDate property in a function
24.Don't show todayDon't show today
25.Check if selected date is nullCheck if selected date is null