Date Widget



 Date widget is used to select dates. The usage is similar to the date/time widget, it provides a more comfortable and improved UI than date/time widget.



                                       


                                   




Methods




Return Type

Method

Description

str

format()

Read the currently set date format.

str

getDateString()

Read the date displayed on the widget as a String with the default format.

str

getDateString( formatString )

Read the date displayed on the widget as a String with the entered format.

int

getDay()

Obtain the day of widgets.

int

getMonth()

Obtain the month of widgets.

int

getYear()

Obtain the year of widgets.


setCurrentDate()

Display the current date on the widget.


setDate( text )

Display the date on the widget.


setDate( year, month, day )

Display the entered date on the widget.


setDay( day )

Set the day of widgets.


setFormat( text )

Set the date format of widgets.


setMonth( month )

Set the month of widgets.


setYear( year )

Set the year of widgets.


setDateSelectMode( type )

Set the date select mode of widgets.




  setDate( text:Time String )

 

  Set the date to the widget.


        ㆍ Enter the time String to text.


  Example)  ‘2013-01-01’



  Example)

   


       obj = canvas.getObject('DateTime');  << Obtain the obejct.

       obj.setDate('2013-01-01');


   




  setDate( year:Year, month:Month, day:Day )

 

  Set the date to the widget.


        ㆍ The date is set according to the parameters(Year, Month, Day).



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setDate(2000, 12, 25);

   





  setCurrentDate()

 

  Display the current date on the widget.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setCurrentDate();

   





  str getDateString( text:Date format )

 

  Obtain the date displayed on widgets as a String with the entered format.


        ㆍ If the text is empty, it obtains the date as a default format.

        ㆍ The default format is ''yyyy-MM-dd'.

        ㆍ If the text is not empty,  it obtains the date as the entered format.


  Example) If the date is 2013-01-01 when entering 'MM-dd', 01-01 is returned.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.


       val = obj.getDateString();   << Read the date as a String with the default format.

       app.messageBox(val);


       val = obj.getDateString('yyyy-MM-dd HH');  << Obtain the currently displaying date as a String with yyyy-MM-dd HH format.

       app.messageBox(val);

   






  setYear( year:Year )

 

  setYear changes the year of widgets to year.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setYear(2012); << Change the year to 2012.


   





  setMonth( month:Month )

 

  setMonth changes the month of widgets to month.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setMonth(11); << Change the month to 11.


   





  setDay( day:Day )

 

  setDay changes the day of widgets to day.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setDay(22); << Change the day to 22.


   





  int getYear()

 

  getYear obtains the year of widgets.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dataTimeWidget objects.

       val = obj.getYear(); << Obtain the year.

       app.messageBox(val);


   





  int getMonth()

 

  getMonth obtains the month of widgets.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       val = obj.getMonth(); << Obtain the month.

       app.messageBox(val);


   





  int getDay()

 

  getDay obtains the day of widgets.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       val = obj.getDay(); << Obtain the day.

       app.messageBox(val);





                                         




  setFormat( text:String format )

 

  Set the date format.


        ㆍ The date format is changed based on text.

        ㆍ The default format is 'yyyy-MM-dd'.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       obj.setFormat('yy.MM.dd');






  str format()

 

  Obtain the current date format.



  Example)

   


       obj = canvas.getObject('DateTime'); << Obtain the dateTimeWidget object.

       val = obj.format();  << Obtain the default format.

 







  setDateSelectMode( type:Mode type )

 

  Set the date select mode of widgets.


        ㆍ There are three kinds of types.

                - 0 : Day

                - 1 : Month

                - 2 : Year



  Example) If the date select mode is set as day.


   


       obj = canvas.getObject('DateTime'); << Obtain the object.

       obj.setDateSelectMode(0);


   



                                       




  Example) If the date select mode is set as month.


   


       obj = canvas.getObject('DateTime'); << Obtain the object.

       obj.setDateSelectMode(1);


   



                                       




  Example) If the date select mode is set as year.


   


       obj = canvas.getObject('DateTime'); << Obtain the object.

       obj.setDateSelectMode(2);