开发环境(Delphi6/ADO/TdxDBGrid/TdxDBEdit)
=========================================我的目的是把一个某表单中的TdxDBTree的Datasource.Dataset 作为另一个编辑表单的各控件的 DataSource.Dataset.然后把这个RecordSet的字段绑字到 各个TdxDBEdit.DataField.以便对记录操作!
但是打开编辑表单后,编辑表单的各编辑控件对绑定的数据不敏感,数据的操作不能在这些控件反应出来. 这些控件的DataField与DataSource都已正确设置.绑定数据源代码
=========================================
procedure TfrmTBASESimpleEditor.loadData;
begin
AdoSetMaster := TADODataSet(oMainTree.DataSource.Dataset);
end;function TfrmTBASESimpleEditor.setControlState:boolean;
var
i ,j: integer;
begin
result :=true;
j :=1; Caption :=sCaption; LbTitle.Caption := sCaption+'编辑';
if ADOSetMaster.Active then
begin
for i:=0 to oMainTree.ColumnCount-1 do
begin
if not oMainTree.Columns[i].Visible then continue;
(FindComponent('Label'+intToStr(j)) as TLabel).Caption :=oMainTree.Columns[i].Caption + ':';
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).DataField :=oMainTree.Columns[i].FieldName;
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).Enabled :=true;
j := j+1;
end;
while j<=5 do
begin
(FindComponent('Label'+intToStr(j)) as TLabel).Visible:=false;
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).Visible:=false;
j :=j+1;
end;
bRet :=true;
case vEditorAction of
eaADD:;
eaEdit: bsOKNew.Visible :=false;
eaView:
begin
bsSkinPanel1.Enabled :=false;
bsOK.Visible :=false;
bsOKNew.Visible :=false;
end;
end;
end
else
begin
bRet :=false;
end;
end;
=========================================我的目的是把一个某表单中的TdxDBTree的Datasource.Dataset 作为另一个编辑表单的各控件的 DataSource.Dataset.然后把这个RecordSet的字段绑字到 各个TdxDBEdit.DataField.以便对记录操作!
但是打开编辑表单后,编辑表单的各编辑控件对绑定的数据不敏感,数据的操作不能在这些控件反应出来. 这些控件的DataField与DataSource都已正确设置.绑定数据源代码
=========================================
procedure TfrmTBASESimpleEditor.loadData;
begin
AdoSetMaster := TADODataSet(oMainTree.DataSource.Dataset);
end;function TfrmTBASESimpleEditor.setControlState:boolean;
var
i ,j: integer;
begin
result :=true;
j :=1; Caption :=sCaption; LbTitle.Caption := sCaption+'编辑';
if ADOSetMaster.Active then
begin
for i:=0 to oMainTree.ColumnCount-1 do
begin
if not oMainTree.Columns[i].Visible then continue;
(FindComponent('Label'+intToStr(j)) as TLabel).Caption :=oMainTree.Columns[i].Caption + ':';
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).DataField :=oMainTree.Columns[i].FieldName;
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).Enabled :=true;
j := j+1;
end;
while j<=5 do
begin
(FindComponent('Label'+intToStr(j)) as TLabel).Visible:=false;
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).Visible:=false;
j :=j+1;
end;
bRet :=true;
case vEditorAction of
eaADD:;
eaEdit: bsOKNew.Visible :=false;
eaView:
begin
bsSkinPanel1.Enabled :=false;
bsOK.Visible :=false;
bsOKNew.Visible :=false;
end;
end;
end
else
begin
bRet :=false;
end;
end;
解决方案 »
- lazarus就是跨平台的delphi,lazarus中文社区官方新群开通
- CreateRemoteThread相关的问题
- 哪位能给我一个VCLskin的非Demo版本?
- for 循环安全吗,试试这个多线程。
- 怎么实现 CTRL+ALT+del中的"锁定计算机"功能?
- 如何动态生成Update语句中的Set子句?
- 求Indy方面的资料(源码和文章都行)!
- 请教!Delphi的ADOQuery查询参数设置问题,在线等待。。。
- 關於Checkbox的問題,急盼回復,等待中.......
- 怎样编制类似于oicq的手机短讯发送程序?
- 在delphi环境中实现调用fastReport做的报表:(报表菜鸟急。。。
- 怎样把文件中的数据一行行读出来?
(FindComponent('dxEdit'+intToStr(j)) as TdxDBEdit).Enabled :=true;仅仅指定了“DataField”而没有指定“DataSource”啊。
另,应该事先用变量保存FindComponent的结果,这样一是可以提高程序执行速度,另外是让代码更加条理清楚,也便于以后维护。—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————