cxLookupComboBox 组件的应用
来源:互联网 发布:网页游戏的数据库修改 编辑:程序博客网 时间:2024/05/19 19:35
1.Setting up a
The LookupComboBox editor is capable of displaying dataset values. Values are displayed within the edit region of an editor and its dropdown window (which displays data in a tabular manner). To establish a connection between the LookupComboBox and the dataset being displayed within the editor, a user needs to specify the property value. This property identifies a instance connected to the dataset (for instance, a object). In this example, the LookupComboBox will be connected to the Customer table from the DBDEMOS database shipped with Borland Delphi or C++ Builder. The following image demonstrates how to connect a LookupComboBox to a data source at design time:
The following code line performs the same actions:
cxLookupComboBox1.Properties.ListSource := DataSource1;
//C++ BuildercxLookupComboBox1->Properties->ListSource = DataSource1;
After that, you must choose the dataset fields to display within the LookupComboBox by setting the property value. This property contains the names of dataset fields and they are separated by semicolon(s). The following image demonstrates how to set up the property value at design time:
The following code sets the property value:
//DelphicxLookupComboBox1.Properties.ListSource := DataSource1; cxLookupComboBox1.Properties.ListFieldNames := 'Company;Addr1';//C++ BuildercxLookupComboBox1->Properties->ListSource = DataSource1; cxLookupComboBox1->Properties->ListFieldNames = "Company;Addr1";Note: On adding a dataset field to the property value, a column is added to the collection. Use the list columns collection editor at design time to edit this collection (or modify the property value):
This editor allows you to set up different options for the dropdown list columns of a lookup combo box. The main property of each lookup combo box column is the property, which specifies the dataset field displayed within a specific column. The and properties determine the display order of a specific column. The property is used to specify the repository item to use as an editor of a specific column抯 contents. For instance, a user can assign a control to represent the values when the ListSource field contains Boolean data. Other properties define the visual representation of columns within the editor dropdown (, , and properties).
The next important thing is to specify the key field used to identify records of the dataset to be displayed within the editor dropdown. The name of the key field must be assigned to the property. The design time approach is demonstrated on the following image:
The following code shoes how to set the property value programmatically:
//DelphicxLookupComboBox1.Properties.ListSource := DataSource1;
cxLookupComboBox1.Properties.ListFieldNames := 'Company;Addr1';cxLookupComboBox1.Properties.KeyFieldNames := 'CustNo;Addr1'; 取KeyFieldNames'CustNo'值: Memo1.Text:=VarToStr(cxLookupComboBox1.EditValue[0]);
取KeyFieldNames'Addr1'值:
Memo1.Text:=VarToStr(cxLookupComboBox1.EditValue[1]);
设置宽度: cxLookupComboBox1.Properties.DropDownWidth:=1000;cbbDeptCode.Properties.DataController.Values[cbbDeptCode.Properties.DataController.FindRecordIndexByKey(cbbDeptCode.EditValue),1]);
就是这个语句,最后面的1就是第二列,从Properties.ListColumns里面取的。
- cxLookupComboBox 组件的应用
- cxLookupComboBox 组件的应用
- cxLookupComboBox
- 在cxLookupCombobox中显示另一列的数据
- 扩展cxLookupComboBox,使其支持多列查询的cxLookupComboBoxEx
- aspjpeg组件的应用
- 组件的基本应用
- 选择组件的应用
- 日历组件的应用
- GridView组件的应用
- RatingBar组件的应用
- ListView组件的应用
- ImageButton组件的应用
- JavaEE应用的组件
- Tab组件与ListView组件的应用
- android: WheelView组件(滑轮组件)的应用!
- android: WheelView组件(滑轮组件)的应用!
- 文件上传组件的应用
- DelphiDistiller1.845
- 短信猫delphi版的短信猫二次开发
- Delphi2010中ADOQuery使用Oracle的Blob字段出现错误解决方法
- C++ 的各种文件读写操作总结
- Socket I/O模型全接触
- cxLookupComboBox 组件的应用
- cxGrid导出Excel
- Debugging Linux Kernel Lockup / Panic / Oops
- ARM Linux外部中断处理过程
- utf-8中的汉字占用多少字节
- ArcGIS应用技巧
- CGCS2000坐标系与其他坐标系间的差异和转换方法
- 使用matlab和GMT联合绘制带有省界的中国地图
- KMP算法及相关问题的总结