我现在用dbgrid来输入数据,第一项是从下拉列表中选或由用户自行输入。我想判断
该数据是否是从下拉列表中输入的,请问该怎样判断?
如果用户输入的和你下拉列表中的某一个字符串完全相同
你怎么判
你不是这个意思吧
DBGRID的这个功能我从不使用
参照我的如下!!!代码吧.
procedure TCQBroker.AssembleParamDispModeItems(AStrings: TStrings);
const
strSql = 'SELECT * FROM PMIS.COM_CQ_DISPMODE WHERE DISPMODE_DISPLAY NOT IN '
+ ' (''CQ_DM_LONGTEXT'', ''CQ_DM_PICTURE'', ''CQ_DM_OLEDOC'') ORDER BY DISPMODE_DISPINDEX';
begin
AStrings.Clear;
with FCallDB do
begin
SqlOpen(strSql);
with DataSet do
begin
while not EOF do
begin
AStrings.AddObject(FieldByName('DISPMODE_NAME').AsString,
TObject(FieldByName('DISPMODE_ID').AsInteger));
Next;
end;
SqlOpenEnd;
end;
end;
end;
procedure TCQParamForm.FormShow(Sender: TObject);
begin
inherited;
with CQBroker do
begin
AssembleFieldTypeItems(dxrParamFieldType.Items);
AssembleParamDispModeItems(dxrParamDispModeID.Items);
end;
end;
procedure TCQParamForm.RefreshFormControlsData(ANode: TTreeNode);
begin
Assert(ANode.Data <> nil);
with CQBroker do
begin
dxrParamDataSource.Items.Clear;
if TObject(ANode.Parent.Parent.Parent.Parent.Data) is TCQDataSet then
AssembleParamDataSourceItems(dxrParamDataSource.Items,
TCQDataSet(ANode.Parent.Parent.Parent.Parent.Data).CQID);
end;
with TCQParam(ANode.Data) do
begin
dxrParamName.Text := CQName;
dxrParamCode.Text := CQCode;
dxrParamNote.Text := CQNote;
dxrParamFieldType.Text := CQFieldType;
dxrParamTitle.Text := CQTitle;
dxrParamDispModeID.Text := dxrParamDispModeID.Items.Strings[dxrParamDispModeID.
Items.IndexOfObject(TObject(CQDispModeID))]; //!!!!!!!!!!
dxrParamIgnorable.Text := CQIgnorable;
dxrParamDefaValue.Text := CQDefaValue;
dxrParamDataSource.Text := CQDataSource;
end;
end;
procedure TCQParamForm.bbtnSaveClick(Sender: TObject);
begin
inherited;
with TCQParam(Node.Data) do
begin
CQName := dxrParamName.Text;
CQCode := dxrParamCode.Text;
CQNote := dxrParamNote.Text;
CQFieldType := dxrParamFieldType.Text;
CQTitle := dxrParamTitle.Text;
CQDispModeID := Integer(dxrParamDispModeID.Items.Objects[dxrParamDispModeID.
Items.IndexOf(dxrParamDispModeID.Text)]); ////!!!!!!!!!!
CQIgnorable := dxrParamIgnorable.Text;
CQDefaValue := dxrParamDefaValue.Text;
CQDataSource := dxrParamDataSource.Text;
DbUpdate;
UpdateTreeNode(Node);
end;
end;