procedure TFBdgeneral.dbgAttribColEnter(Sender: TObject);
begin
//点取'XX'字段时下拉菜单
if dbgAttrib.SelectedField.FieldName='XX' then
begin
maindm.ClientmyQuery.Close;
maindm.ClientmyQuery.CommandText:='SELECT content FROM table';
maindm.ClientmyQuery.Open;
dbgAttrib.Columns[1].PickList.Clear;//表示colums[1]表示dbgattrib中的第二个字段
if maindm.ClientmyQuery.RecordCount>0 then
begin
maindm.ClientmyQuery.First;
while not maindm.ClientmyQuery.Eof do
begin
dbgAttrib.Columns[1].PickList.Add(trim(maindm.ClientmyQuery.Fieldbyname('content').asstring));//动态地把查寻到的内容一个个加到你的下拉表里
maindm.ClientmyQuery.Next;
end;
end;
maindm.ClientmyQuery.Close;
end;
end;
显示下拉方式的列
你可以通过KeyList 和 PickList 属性在相关的的字段中显示其它文本。KeyList显示包含在字段的值而非PickList索引所包含的值。 Column.NotInKeyListIndex to index of text from PickList that will be shown if field value do not contain in KeyList (for instance you can set index of text for Null field value). Set Column.DblClickNextval to True to change value on mouse double click.