写作日期:2019-10-12 作者:习践无界
希望对大家有所利益,同大家结个缘分。尤其是新学Delphi的朋友。
动态设置cxgrid列的Properties:
var B:TcxlookupcomboboxProperties; sList1:TStringList;
B:=tcxlookupcomboboxproperties.create(self);
B.ListSource:=MyDataSource;//绑定动态生成的DataSource
B.ListFieldNames:=ADOQuery1.FieldByName('AAA).AsString ;//绑定数据库配置表中的字段
B.KeyFieldNames:=ADOQuery1.FieldByName(‘BBB’).AsString ;//绑定数据库配置表中的字段
B.ListOptions.SyncMode:=True;//ListSource对应的数据集跟随用户选择进行定位
B.DropDownWidth:=700;
B.DropDownSizeable:=True;
B.OnEditValueChanged:=MyEditValueChanged;//重写OnEditValueChanged事件
//利用TStringList动态对字段ListFieldIndex赋值 sList1:=TStringList.Create;
SList1.Clear;
SList1.Delimiter := ‘;’;
//从数据库配置表获取配置信息,内容格式为:’编号;名称;类别’ ;
SList1.DelimitedText:=ADOQuery1.FieldByName(‘CCC’).AsString;
B.ListFieldI