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

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
m
 
Line 9: Line 9:
 
  {{DISPLAYTITLE:Numeric Field}}
 
  {{DISPLAYTITLE:Numeric Field}}
 
It is recommended to use the numeric field control <idl>com.sun.star.awt.UnoControlNumericField</idl> if the user input is limited to numeric values. The numeric value is controlled by the <code>Value</code> property, which is of type <code>Double</code>. A minimum and maximum value for user input is defined by the <code>ValueMin</code> and the <code>ValueMax</code> property. The decimal accuracy of the numeric value is specified by the <code>DecimalAccuracy</code> property, for example, a value of 6 corresponds to 6 decimal places. If the <code>ShowThousandsSeparator</code> property is set to <code>True</code>, a thousands separator is displayed. The numeric field also has a built-in spin button, enabled by the <code>Spin</code> property. The spin button is used to increment and decrement the displayed numeric value by clicking with the mouse, whereas the step is set by the <code>ValueStep</code> property.
 
It is recommended to use the numeric field control <idl>com.sun.star.awt.UnoControlNumericField</idl> if the user input is limited to numeric values. The numeric value is controlled by the <code>Value</code> property, which is of type <code>Double</code>. A minimum and maximum value for user input is defined by the <code>ValueMin</code> and the <code>ValueMax</code> property. The decimal accuracy of the numeric value is specified by the <code>DecimalAccuracy</code> property, for example, a value of 6 corresponds to 6 decimal places. If the <code>ShowThousandsSeparator</code> property is set to <code>True</code>, a thousands separator is displayed. The numeric field also has a built-in spin button, enabled by the <code>Spin</code> property. The spin button is used to increment and decrement the displayed numeric value by clicking with the mouse, whereas the step is set by the <code>ValueStep</code> property.
 
+
<source lang="oobas">
 
   oNumericFieldModel = oDialog.Model.NumericField1
 
   oNumericFieldModel = oDialog.Model.NumericField1
 
   oNumericFieldModel.Value = 25.40
 
   oNumericFieldModel.Value = 25.40
 
   oNumericFieldModel.DecimalAccuracy = 2
 
   oNumericFieldModel.DecimalAccuracy = 2
 
+
</source>
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Basic and Dialogs]]
 
[[Category:Documentation/Developer's Guide/Basic and Dialogs]]

Latest revision as of 10:08, 22 October 2009



It is recommended to use the numeric field control com.sun.star.awt.UnoControlNumericField if the user input is limited to numeric values. The numeric value is controlled by the Value property, which is of type Double. A minimum and maximum value for user input is defined by the ValueMin and the ValueMax property. The decimal accuracy of the numeric value is specified by the DecimalAccuracy property, for example, a value of 6 corresponds to 6 decimal places. If the ShowThousandsSeparator property is set to True, a thousands separator is displayed. The numeric field also has a built-in spin button, enabled by the Spin property. The spin button is used to increment and decrement the displayed numeric value by clicking with the mouse, whereas the step is set by the ValueStep property.

  oNumericFieldModel = oDialog.Model.NumericField1
  oNumericFieldModel.Value = 25.40
  oNumericFieldModel.DecimalAccuracy = 2
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages