cxLookupComboBox 组件的应用
来源:互联网 发布:抓取京东商品信息 php 编辑:程序博客网 时间:2024/05/28 05:17
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组件(滑轮组件)的应用!
- 文件上传组件的应用
- 省略符形参
- WinForm程序虚拟分页(实时加载数据)
- poj 2381 && 2398 叉积+二分
- android thread handler timertask
- MTK timer
- cxLookupComboBox 组件的应用
- android TextView中文字通过SpannableString设置属性
- 图形
- 我在Linux下的备份方法(一)
- 各操作系统中的换行符差异
- C++ 一些基本语法
- Ubuntu 10.04使用Wine安装Source Insight
- PC上开发驱动之printk显示
- 计算机几何题目