4 Replies Latest reply on Aug 9, 2006 10:46 PM by Kishan M V

    DateChooser problem / bug

      Hello
      I had problem with DateChooser component. If I use selectedDate property for setting initial selected date. Calendar is displayed with correct month and year - but date aren't highlight.

      Second problem is when I try to make function go to today. When I set first time property displayedMonth and displayedYear it is working - after I scroll to other month or year and when I try call again same property for today nothing happen...

      Both for me looks like bug.

      Second I was able solve with double setting displayedMonth when in first case I set different value. But I can found how to highlight selected date.
        • 1. Re: DateChooser problem / bug
          Poomani
          Problem #1 :

          You notice that blue highlight on Dec 25 once the button is clicked

          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
          <mx:Script>
          <![CDATA[
          public function setDate():void{
          myDC.selectedDate =new Date(2006,11,25);

          }
          ]]>
          </mx:Script>
          <mx:DateChooser id="myDC"/>
          <mx:Button label="Set Christmas date" click="setDate()"/>
          </mx:Application>

          Problem #2
          I am not getting your point can u provide some sample code and the steps to repro the issue
          1 person found this helpful
          • 2. Re: DateChooser problem / bug
            Here is my code - I use this mx component inside other application. Strange is I made some small test application for calling this component and all looks correct but inside my bigger - application it doesnt want work - display date without green focus field (only scroll on corresponding month and year) But calling is absolutly same. I have suspicion on some problem with binding - because date value what I set in my main aplication is also bindable variable.

            Second problem you can easy check if you comment line mention in code.

            And thanks for your help.

            <?xml version="1.0" encoding="utf-8"?>
            <mx:TitleWindow xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal" width="100%" height="100%" creationComplete="init();" title="{_titleText}" styleName="popUpPanel">
            <mx:Style>

            </mx:Style>
            <mx:Script>
            <![CDATA[
            import mx.controls.LinkButton;
            import mx.core.UIComponent;
            import mx.managers.PopUpManager;
            import mx.validators.StringValidator;
            import retailVision.ui.PFdateChooser;
            // import mx.managers.FocusManager;

            [Bindable]
            public var _value:Date = new Date();

            [Bindable]
            public var _fn:Function;

            [Bindable]
            public var _closeText:String = "Close";

            [Bindable]
            public var _okText:String = "OK" ;

            [Bindable]
            public var _showToday:String = "Show today" ;

            [Bindable]
            public var _titleText:String = "Select date:";


            private function init():void{
            PopUpManager.centerPopUp(this);
            trace(this.stage.quality + "<quality");
            checkDate();
            }

            private function okAction():void{
            PopUpManager.removePopUp(this);
            try{
            _fn.call(parent);
            }catch(err:Error){

            }
            }

            private function showToday(value:Date):void{
            var year:int = value.getFullYear();
            var month:int = value.getMonth();

            //If you comment this part show today stops work
            var bugFixMonth:int = (month - 1 > 0)? 11 : month - 1;
            cal.displayedMonth = bugFixMonth;
            cal.displayedYear = year - 1;
            //End of part

            cal.displayedMonth = month;
            cal.displayedYear = year;
            }

            private function checkDate():void{
            //Todo: Hide show today button on scroll event in case when today is hide
            }

            ]]>
            </mx:Script>
            <mx:Form defaultButton="{okBut}" paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0">
            <mx:VBox>
            <mx:DateChooser id="cal" selectedDate="{_value}" scroll="checkDate();" />
            <mx:HBox width="100%">
            <mx:Button id="showTodayBut" label="{_showToday}" height="50" click="showToday(new Date());checkDate();"></mx:Button>
            <mx:Spacer width="100%"/>
            <mx:Button id="okBut" label="{_okText}" height="50"></mx:Button>
            <mx:Button id="cancelBut" styleName="redButton" label="{_closeText}" click="PopUpManager.removePopUp(this);" height="50"></mx:Button>
            </mx:HBox>
            </mx:VBox>
            </mx:Form>
            </mx:TitleWindow>
            • 3. Re: DateChooser problem / bug
              I found where is problem problem is inside of component in comparing dates.

              check this I add to date hours and minuts:

              <?xml version="1.0"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
              <mx:Script>
              <![CDATA[
              public function setDate():void{
              myDC.selectedDate =new Date(2006, 11, 25, 11, 11);

              }
              ]]>
              </mx:Script>
              <mx:DateChooser id="myDC"/>
              <mx:Button label="Set Christmas date" click="setDate()"/>
              </mx:Application>
              • 4. Re: DateChooser problem / bug
                Kishan M V Adobe Employee
                Hi,

                Thanks for the bug report, we are keeping track both the bugs.

                Thanks