Difference between revisions of "Documentation/DevGuide/Basic/Check Box"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
 
(5 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/Basic/Option Button
 
|NextPage=Documentation/DevGuide/Basic/Option Button
 
}}
 
}}
{{DISPLAYTITLE:Check Box}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Basic/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Check Box}}
 
The check box control <idl>com.sun.star.awt.UnoControlCheckBox</idl> is used in groups to display multiple choices so that the user can select one or more choices. When a check box is selected it displays a check mark. Check boxes work independently of each other, thus different from option buttons. A user can select any number of check boxes at the same time.
 
The check box control <idl>com.sun.star.awt.UnoControlCheckBox</idl> is used in groups to display multiple choices so that the user can select one or more choices. When a check box is selected it displays a check mark. Check boxes work independently of each other, thus different from option buttons. A user can select any number of check boxes at the same time.
  
 
The property <code>State</code>, where 0 is not checked, 1 is checked, 2 is don't know, accesses and changes the state of a checkbox. The tri-state mode of a check box is enabled by setting the <code>TriState</code> property to True. A tri-state check box provides the additional state "don't know", that is used to give the user the option of setting or unsetting an option.  
 
The property <code>State</code>, where 0 is not checked, 1 is checked, 2 is don't know, accesses and changes the state of a checkbox. The tri-state mode of a check box is enabled by setting the <code>TriState</code> property to True. A tri-state check box provides the additional state "don't know", that is used to give the user the option of setting or unsetting an option.  
 
+
<syntaxhighlight lang="oobas">
 
   oCheckBoxModel = oDialog.Model.CheckBox3
 
   oCheckBoxModel = oDialog.Model.CheckBox3
 
   oCheckBoxModel.TriState = True
 
   oCheckBoxModel.TriState = True
 
   oCheckBoxModel.State = 2
 
   oCheckBoxModel.State = 2
 
+
</syntaxhighlight>
 
The same result is achieved by using the <idl>com.sun.star.awt.XCheckBox</idl> interface:
 
The same result is achieved by using the <idl>com.sun.star.awt.XCheckBox</idl> interface:
 
+
<syntaxhighlight lang="oobas">
 
   oCheckBox = oDialog.getControl("CheckBox3")
 
   oCheckBox = oDialog.getControl("CheckBox3")
 
   oCheckBox.enableTriState( True )
 
   oCheckBox.enableTriState( True )
 
   oCheckBox.setState( 2 )
 
   oCheckBox.setState( 2 )
 +
</syntaxhighlight>
 +
{{PDL1}}
  
{{PDL1}}
+
[[Category:Documentation/Developer's Guide/Basic and Dialogs]]
[[Category: Basic and Dialogs]]
+

Latest revision as of 21:26, 20 December 2020



The check box control com.sun.star.awt.UnoControlCheckBox is used in groups to display multiple choices so that the user can select one or more choices. When a check box is selected it displays a check mark. Check boxes work independently of each other, thus different from option buttons. A user can select any number of check boxes at the same time.

The property State, where 0 is not checked, 1 is checked, 2 is don't know, accesses and changes the state of a checkbox. The tri-state mode of a check box is enabled by setting the TriState property to True. A tri-state check box provides the additional state "don't know", that is used to give the user the option of setting or unsetting an option.

  oCheckBoxModel = oDialog.Model.CheckBox3
  oCheckBoxModel.TriState = True
  oCheckBoxModel.State = 2

The same result is achieved by using the com.sun.star.awt.XCheckBox interface:

  oCheckBox = oDialog.getControl("CheckBox3")
  oCheckBox.enableTriState( True )
  oCheckBox.setState( 2 )
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages