PDroplist

(Dialog Library)

Description:

Parameter Setting Droplist. This module draws a droplist with (optional) title and bevel.

Returns: Nothing
Usage: Steady State only.
Function Groups: Graphics
Related to: GUITransform | PAddressEntry | PAlmPriority | PAreaSelect | PCheckBox | PColorEdit | PColorSelect | PContributor | PEditField | PEditName | PFileChooser | PHSliderBar | PHueSelect | PImageSelect | PIPAddressList | PIPListenerGroup | PMultiCheckBox | PPageSelect | PPhraseEdit | PRadioButtons | PSecBit | PSelectObject | PServerListName | PSpinbox | PTimeZone | PTypeToggle | SiteDispParmsSiteDispParms
Format: \DialogLibrary.PDropList(ParmNum, Title, DataOrAlignTitle [, CanEdit, Index, FocusID, Trigger, Init, DrawBevel, VertAlign, AlignTitle_L0, RetArray_L1, DoNotTranslate_L2, ..., L16])
Parameters:  
ParmNum
Required. Any numeric expression giving the parameter number (from 0) in the caller to alter.
Title
Required. Any text expression to be used as a title for the droplist.
DataOrAlignTitle
Required. A flexible parameter that is either an array of data to display in the droplist, or a logical expression indicating the alignment of the droplist's title.
If this is an array, the parameter called AlignTitleOrL1 indicates the title alignment.
If this parameter is invalid or numeric, it indicates the title alignment such that if it is TRUE (non-0) the title is included in the calculation for vertical alignment, if FALSE (0) it is added to the droplist after it (and its bevel if one exists) has been vertically aligned. The default is TRUE.
CanEdit
An optional parameter that is any logical expression. If TRUE (non-0) the text displayed in the droplist can be edited in the same manner as an editfield, if FALSE (0) it cannot be edited directly. The default value is FALSE.
Index
An optional parameter that is a variable whose value indicates the array index of the highlighted item in the list. If this information is not required, a constant may be used. This value will be used to calculate the initial value displayed in the droplist (see Init).
FocusID
Boolean. If this value is FALSE (0), the field will display its current setting, but cannot be opened (i.e. its value cannot be changed), and will appear disabled (grayed-out).
Trigger
Optional. If the droplist is editable, Trigger provides feedback. While editing, the value will be 0. When editing is complete (tab, enter or loss of focus) the value will change to non-zero, 1 if enter is pressed, and 2 otherwise.
Init
An optional parameter that is any expression for the initial value displayed in the field. The default value is Parms[ParmNum]. If Index is invalid, the droplist will initially appear blank.
DrawBevel
An optional parameter that is any logical expression. If true (non-0) a bevel is drawn around the droplist, if false (0) no bevel is drawn. The default value is true.
VertAlign
An optional parameter that is any numeric expression that sets the vertical alignment of the unopened droplist according to one of the following:

VertAlign

Vertical Alignment

0

Top

1

Center

2

Bottom

Whether the title is included when the vertical alignment is calculated is determined by the value of AlignTitle. The default value is 0.

AlignTitle_L0
A flexible parameter that is either a logical expression indicating the alignment of the title, or it is the first label (option) in the list that is displayed by this graphic. If the parameter called DataOrAlignTitle is a data array of options, this parameter will indicate the title alignment (see the summary for the DataOrAlignTitle parameter) otherwise this will be any text expression that gives the first label in the dropped list.
RetArray_L1
A flexible parameter that is either the second label in the list displayed by this graphic, or it can be an array of values to which the parameter at ParmNum will be set. This allows PDropList to be used in places that would otherwise need to use System.Droplist and manually set the value of Parameter[#ParmNum]
DoNotTranslate_L2
A flexible parameter that is either a logical expression indicating that text should not be translated (when set TRUE), or the third label in the list.
L3, ...L16
A list of text expressions giving the remaining options in the dropped list. Any number of these may be left invalid. The resulting list displayed when droplist is opened will contain all valid entries in the 16 available positions.
Comments:


This module is a member of the VTScada Dialog Library and must therefore be called from within a GUITransform and prefaced by \DialogLibrary\.
The "P" tools (Pcheck box, PContributor, PColorSelect, PDroplist, and PEditField) were intended only for use in configuration folders and drawing panel modules, and therefore are subject to the system security restraints.

This parameter tool expects the first parameter of its calling module to contain an array of tag parameters. It will then set the element indicated by ParmNum to the text string displayed in the selected line of the droplist.
The height of the (unopened) droplist is constant, with the horizontal boundaries of its calling transform defining its width, and the vertical boundaries of its calling transform defining its opened height, which will include the added height of the bevel above the field, but may or may not include the title, depending on the alignment used. Note that if the entire list can be displayed in a smaller area than indicated by the vertical boundaries of the calling transform, the dropped list height will be decreased. The dropped height of the list will always have a minimum height of 1 line (below the field).
For any optional parameter that is to be set, all optional parameters preceding the desired one must be present, although they may be invalid.

Usual height: 40

Example:

The following example illustrates the data options being stored in an array:

  GUITransform(70, 210, 210, 170,
               1, 1, 1, 1, 1,
               0, 0, 1, 0,
               0, 0, 0,
               \DialogLibrary.PDroplist(6          { Parm num             },
                                        \GetPhrase("Your_Title")  { Title },
                                        PLCTypes   { Array of data        },
                                        FALSE      { Not editable         },
                                        Idx        { Chosen element       },
                                        FALSE      { Focus ID             },
                                        0          { Trigger not req'd    },
                                        Invalid    { Use default for init },
                                        TRUE       { Draw bevel           },
                                        1          { Center list          },
                                        0          { Align top of bevel   }));

The next example shows how data options may be entered as a grouping of text strings:

  GUITransform(70, 210, 210, 170,
               1, 1, 1, 1, 1,
               0, 0, 1, 0,
               0, 0, 0,
               \DialogLibrary.PDroplist(6         { Parm num             },
                                        \GetPhrase("Your_Title") { Title },
                                        1         { Align title with top },
                                        FALSE     { Not editable         },
                                        Idx       { Chosen element       },
                                        TRUE      { Focus ID             },
                                        0         { Trigger not req'd    },
                                        Invalid   { Use default for init },
                                        TRUE      { Draw bevel           },
                                        1         { Center list          },
                                        "PLC-2", "PLC-3", 
                                        "PLC-5", "PLC-5/250",
                                        "SLC-500" { Options in list      }));