ListBox.FillUsing Method (Typed) | |
Specify the set of values to be displayed in the list box, using an array or a data server. These values act as a constraint on the values that may be entered in the list box, and optionally as a translation between program values and display values.
Namespace:
XSharp.VO.SDK
Assembly:
XSharp.VOGUIClasses (in XSharp.VOGUIClasses.dll) Version: 2.19
Syntax VIRTUAL METHOD FillUsing(
aContents,
symField1,
symField2
) AS USUAL CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public virtual Usual FillUsing(
Usual aContents = default,
Usual symField1 = default,
Usual symField2 = default
)
Request Example
View SourceParameters
- aContents (Optional)
- Type: Usual
An array containing the values to be placed in the list box. A two-dimensional array may be used to define the values to be returned to the program when a list item is selected, separately from the text strings shown in the list; this 'other' value is what is returned in the ListBox:Value property, and what is stored in the database if the control is associated with a database field.
Thus, the array may be specified in one of two formats:
1. | One-dimensional array containing the list of values. |
2. |
Array of two-element arrays, each containing the string to display in the list and the corresponding value returned to the program.
Note that the two dimensional array has the same structure as that returned by DBServer:GetLookupTable(), and the
one-dimensional array matches that returned by DBServer:GetArray(). or The data server that is to be used to provide the set of values.
|
- symField1 (Optional)
- Type: Usual
The symbolic name of the field that is to be used for the display values. If not specified, the values of the first field are used. - symField2 (Optional)
- Type: Usual
The symbolic name of the field that is to be used for the values that are returned to the program. If not specified, the values of the first field are used.
Return Value
Type:
UsualRemarks
A list box shows the set of valid values for a field. Depending on what type of list box is used, the set of values may act as a constraint on the values that may be retrieved or only as a suggestion. Two sets of values may be specified, allowing for translation of values between the displayed, "human-readable" representation and the internal, programmatic value.
The FillUsing() method provides a way of specifying the values to be included in the list all at once, instead of constructing the list item by item with the AddItem() method.
Tip |
---|
The list box control may be associated with a database field, just like any other control. Do not confuse this primary field linkage with the possibility of linking the list box to a secondary server used for populating the list. |
Examples
Create a list box with different currencies, showing an explicit representation to the user but using a different representation internally:
1METHOD Init(...) CLASS OrderWindow
2...
3oLBCurrency := ListBox{SELF,LBCURRENCY_ID}
4oLBCurrency:FillUsing({;
5{"U.S. Dollars","USD"},;
6{"Can. Dollars","CDN"},;
7{"Mexican Pesos","MEX"},;
8{"Yen","YEN"},;
9{"British Pounds","UK"},;
10{"German Marks","DM"};
11})
12oLBCurrency:Show()
Create a list box that shows the products available in the product table:
1METHOD Init(...) CLASS OrderWindow
2...
3oLBProducts := ListBox{SELF,LBPRODUCTS_ID}
4oLBProducts:FillUsing(oDBProducts,#ProdName,#ProdNo)
5oLBProducts:Show()
See Also