Difference between revisions of "Documentation/DevGuide/Basic/Date Field"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
 
(6 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/Basic/Time Field
 
|NextPage=Documentation/DevGuide/Basic/Time Field
 
}}
 
}}
{{DISPLAYTITLE:Date Field}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}}
The date field control <idl>com.sun.star.awt.UnoControlDateField</idl> extends the text field control and is used for displaying and entering dates. The date displayed in the date field is controlled by the <code>Date</code> property. The date value is of type <code>Long</code> and must be specified in the format YYYYMMDD, for example, the date September 30th, 2002 is set in the following format:
+
{{DISPLAYTITLE:Date Field}}
 
+
The date field control <idl>com.sun.star.awt.UnoControlDateField</idl> extends the text field control and is used for displaying and entering dates. The date displayed in the date field is controlled by the <code>Date</code> property. The date value is of type <code>Long</code> and must be specified in the format YYYYMMDD, for example, the date September 30th, 2020 is set in the following format:
 +
<syntaxhighlight lang="oobas">
 
   oDateFieldModel = oDialog.Model.DateField1
 
   oDateFieldModel = oDialog.Model.DateField1
   oDateFieldModel.Date = 20020930
+
   oDateFieldModel.Date = 20200930
 
+
</syntaxhighlight>
 
The current date is set by using the Date and <code>CDateToIso</code> runtime functions:
 
The current date is set by using the Date and <code>CDateToIso</code> runtime functions:
 
+
<syntaxhighlight lang="oobas">
 
   oDateFieldModel.Date = CDateToIso( Date() )
 
   oDateFieldModel.Date = CDateToIso( Date() )
 
+
</syntaxhighlight>
 
The minimum and the maximum date that the user can enter is defined by the <code>DateMin</code> and the <code>DateMax</code> property. The format of the displayed date is specified by the <code>DateFormat</code> and the <code>DateShowCentury</code> property, but the usage of <code>DateShowCentury</code> is deprecated. Some formats are dependent on the system settings. If the <code>StrictFormat</code> property is set to True, the date entered by the user is checked during input. The <code>Dropdown</code> property enables a calendar that the user can drop down to select a date.  
 
The minimum and the maximum date that the user can enter is defined by the <code>DateMin</code> and the <code>DateMax</code> property. The format of the displayed date is specified by the <code>DateFormat</code> and the <code>DateShowCentury</code> property, but the usage of <code>DateShowCentury</code> is deprecated. Some formats are dependent on the system settings. If the <code>StrictFormat</code> property is set to True, the date entered by the user is checked during input. The <code>Dropdown</code> property enables a calendar that the user can drop down to select a date.  
  
 
<!--[BUG641+]-->
 
<!--[BUG641+]-->
<code>Dropdown</code> is currently not working.
+
<code>Dropdown</code> is currently not working by program, but you can set it with the Control Properties in the IDE.
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Basic and Dialogs]]
+
 
 +
[[Category:Documentation/Developer's Guide/Basic and Dialogs]]

Latest revision as of 12:49, 21 December 2020



The date field control com.sun.star.awt.UnoControlDateField extends the text field control and is used for displaying and entering dates. The date displayed in the date field is controlled by the Date property. The date value is of type Long and must be specified in the format YYYYMMDD, for example, the date September 30th, 2020 is set in the following format:

  oDateFieldModel = oDialog.Model.DateField1
  oDateFieldModel.Date = 20200930

The current date is set by using the Date and CDateToIso runtime functions:

  oDateFieldModel.Date = CDateToIso( Date() )

The minimum and the maximum date that the user can enter is defined by the DateMin and the DateMax property. The format of the displayed date is specified by the DateFormat and the DateShowCentury property, but the usage of DateShowCentury is deprecated. Some formats are dependent on the system settings. If the StrictFormat property is set to True, the date entered by the user is checked during input. The Dropdown property enables a calendar that the user can drop down to select a date.

Dropdown is currently not working by program, but you can set it with the Control Properties in the IDE.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages