Besturingselementen voor formulieren in detail

From Apache OpenOffice Wiki
< NL‎ | Documentation‎ | BASIC Guide
Revision as of 12:26, 30 March 2013 by DiGro (Talk | contribs)

Jump to: navigation, search
Book.png


De beschikbare besturingselementen in formulieren zijn gelijk aan die van die in dialoogvensters. De selectie reikt van eenvoudige tekstvelden via keuzelijsten en combinatievakken tot diverse knoppen.

Hieronder vindt u een lijst met de meest belangrijke eigenschappen voor besturingselementen voor formulieren. Alle eigenschappen vormen een deel van de geassocieerde model-objecten.

In aanvulling op de standaard besturingselementen, is ook een tabel-controleveld-element beschikbaar voor formulieren, welke de complete medewerking van gegevensbron-tabellen toestaat. Dit wordt beschreven in het gedeelte Gegevensbron Formulieren in hoofdstuk Database-formulieren.

Knoppen

Het model-object van een besturingselement Knop verschaft de volgende eigenschappen:

BackgroundColor (long)
achtergrondkleur
DefaultButton (Boolean)
de knop dient als een standaard waarde. In dit geval reageert het ook op de invoer-knop als het geen focus heeft
Enabled (Boolean)
het besturingselement kan worden geactiveerd
Tabstop (Boolean)
het besturingselement kan worden bereikt via de tabulator-toets [Tab]
TabIndex (Long)
positie van het besturingselement in de volgorde van activering
FontName (String)
naam van het lettertype
FontHeight (Single)
hoogte van het teken in punten (pt)
Tag (String)
tekenreeks die aanvullende informatie bevat, die kan worden opgeslagen in de knop voor programma-gecontroleerde toegang
TargetURL (String)
doel-URL voor knoppen van het type URL
TargetFrame (String)
naam van het venster (of frame) waarin de TargetURL moet worden geopend bij activering van de knop (voor knoppen van het type URL)
Label (String)
label voor de knop
TextColor (Long)
tekstkleur van het besturingselement
HelpText (String)
automatisch weergegeven tekst van de Help die wordt weergegeven als de muisaanwijzer boven het besturingselement is
HelpURL (String)
URL van de online Help voor het overeenkomende besturingselement
ButtonType (Enum)
actie die is gekoppeld aan de knop (standaard waarde uit com.sun.star.form.FormButtonType)
State (Short)
in schakelknop, 1 = ingedrukt, 0 = normaal

Via de eigenschap ButtonType heeft u de mogelijkheid om een actie te definiëren die wordt uitgevoerd als de knop wordt ingedrukt. De geassocieerde groep van constanten com.sun.star.form.FormButtonType verschaft de navolgende waarden:

PUSH
standaard knop
SUBMIT
einde van formulier invoer (speciaal van belang voor formulieren in HTML)
RESET
herstelt alle waarden binnen het formulier naar hun originele waarden
URL
aanroep van de URL gedefinieerd in TargetURL (wordt geopend binnen het venster dat was gespecificeerd via TargetFrame)

De typen knop OK en Annuleren, die beschikbaar zijn in dialoogvensters, worden niet ondersteund in formulieren.

Optieknoppen

De volgende eigenschappen van een Optieknop zijn beschikbaar via zijn model-object:

Enabled (Boolean)
the control element can be activated
Tabstop (Boolean)
the control element can be reached through the tab key
TabIndex (Long)
position of control element in the activation sequence
FontName (String)
name of font type
FontHeight (Single)
height of character in points (pt)
Tag (String)
string containing additional information, which can be saved in the button for program-controlled access
Label (String)
inscription of button
Printable (Boolean)
the control element can be printed
State (Short)
if 1, the option is activated, otherwise it is deactivated
RefValue (String)
string for saving additional information (for example, for administering data record IDs)
TextColor (Long)
text color of control element
HelpText (String)
automatically displayed help text, which is displayed if the mouse cursor is above the control element
HelpURL (String)
URL of online help for the corresponding control element

The mechanism for grouping option buttons distinguishes between the control elements for dialogs and forms. Whereas control elements appearing one after another in dialogs are automatically combined to form a group, grouping in forms is performed on the basis of names. To do this, all option buttons of a group must contain the same name. Apache OpenOffice combines the grouped control elements into an array so that the individual buttons of a Apache OpenOffice Basic program can be reached in the same way.

The following example shows how the models of the control elements of a group can be iterated, exemplary displaying the states of all control elements in a given group:

Function test
  Dim oGroup as object
  Dim Doc As Object
  Dim Forms As Object
  Dim Form As Object
  Dim Ctl As Object
  Dim I as Integer
 
  Doc = ThisComponent
  Forms = Doc.Drawpage.Forms
 
  Form = Forms.GetbyIndex(0)
 
  oForm.getGroupByName("MyOptions", oGroup)
  msg = ""
  for i = LBound(oGroup) to UBound(oGroup)
    oCtl = oGroup(i)
    msg = msg + oCtl.Name + ": " + (str(oCtl.State)) + chr(10)
  next i
  MsgBox msg 
 
end Function

The code corresponds to the previous example for determining a simple control element model. It accesses the array of models using the GetGroupByName method (rather than the GetByName method to determine simple models).

Checkboxes

The model object of a checkbox form provides the following properties:

Enabled (Boolean)
the control element can be activated
Tabstop (Boolean)
the control element can be reached through the tab key
TabIndex (Long)
position of control element in the activation sequence
FontName (String)
name of font type
FontHeight (Single)
height of character in points (pt)
Tag (String)
string containing additional information, which can be saved in the button for program-controlled access
Label (String)
button label
Printable (Boolean)
the control element can be printed
State (Short)
if 1, the option is activated, otherwise it is deactivated
RefValue (String)
string for saving additional information (for example, for administrating data record IDs)
TextColor (Long)
text color of control element
HelpText (String)
automatically displayed help text, which is displayed if the mouse cursor is above the control element
HelpURL (String)
URL of online help for the corresponding control element

Text Fields

The model objects of text field forms offer the following properties:

Align (short)
orientation of text (0: left-aligned, 1: centered, 2: right-aligned)
BackgroundColor (long)
background color of control element
Border (short)
type of border (0: no border, 1: 3D border, 2: simple border)
EchoChar (String)
echo character for password field
FontName (String)
name of font type
FontHeight (Single)
height of character in points (pt)
HardLineBreaks (Boolean)
the automatic line breaks are permanently inserted in the text of the control element
HScroll (Boolean)
the text has a horizontal scrollbar
MaxTextLen (Short)
maximum length of text; if 0 is specified, there are no limits
MultiLine (Boolean)
permits multi-line entries
Printable (Boolean)
the control element can be printed
ReadOnly (Boolean)
the content of the control element is read-only
Enabled (Boolean)
the control element can be activated
Tabstop (Boolean)
the control element can be reached through the tab key
TabIndex (Long)
position of the control element in the activation sequence
FontName (String)
name of font type
FontHeight (Single)
height of character in points (pt)
Text (String)
text of control element
TextColor (Long)
text color of control element
VScroll (Boolean)
the text has a vertical scrollbar
HelpText (String)
automatically displayed help text, which is displayed if the mouse cursor is above the control element
HelpURL (String)
URL of online help for the corresponding control element

List Boxes

The model object of the list box forms provides the following properties:

BackgroundColor (long)
background color of control element
Border (short)
type of border (0: no border, 1: 3D frame, 2: simple frame)
FontDescriptor (struct)
structure with details of font to be used (in accordance with com.sun.star.awt.FontDescriptor structure)
LineCount (Short)
number of lines of control element
MultiSelection (Boolean)
permits multiple selection of entries
SelectedItems (Array of Strings)
list of highlighted entries
StringItemList (Array of Strings)
list of all entries
ValueItemList (Array of Variant)
list containing additional information for each entry (for example, for administrating data record IDs)
Printable (Boolean)
the control element can be printed
ReadOnly (Boolean)
the content of the control element is read-only
Enabled (Boolean)
the control element can be activated
Tabstop (Boolean)
the control element can be reached through the tab key
TabIndex (Long)
position of control element in the activation sequence
FontName (String)
name of font type
FontHeight (Single)
height of character in points (pt)
Tag (String)
string containing additional information which can be saved in the button for program-controlled access
TextColor (Long)
text color of control element
HelpText (String)
automatically displayed help text, which is displayed if the mouse cursor is above the control element
HelpURL (String)
URL of online help for the corresponding control element
Documentation note.png VBA : Through their ValueItemList property, list box forms provide a counterpart to the VBA property, ItemData, through which you can administer additional information for individual list entries.


Furthermore, the following methods are provided though the view object of the list box:

addItem (Item, Pos)
inserts the string specified in the Item at the Pos position in the list
addItems (ItemArray, Pos)
inserts the entries listed in the string's ItemArray data field in the list at the Pos position
removeItems (Pos, Count)
removes Count entries as of the Pos position
selectItem (Item, SelectMode)
activates or deactivates the highlighting for the element specified in the string Item depending on the SelectMode variable
makeVisible (Pos)
scrolls through the list field so that the entry specified by Pos is visible


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