可以自己写一个Procedure Terp.sx1(component:string;form:string); var i:integer; begin with application.FindComponent(form) as tform do begin //当选中的字段是STRING类型时 // if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) then if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftwidestring) then begin If Application.findcomponent('zdsx')=nil Then Application.CreateForm(Tzdsx, zdsx); If Application.findcomponent('rqsx')=nil Then Application.CreateForm(Trqsx, rqsx); for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin if pos('期',tdbgrideh(FindComponent(component)).Columns[i].Title.Caption)>0 then begin rqsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; rqsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; rqsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; zdsx.Release; rqsx.show; end else begin zdsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; zdsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; rqsx.Release; zdsx.show; end; exit; end; end; end; //当选中的字段是日期型时 if tdbgrideh(FindComponent(component)).SelectedField.DataType=ftdatetime then begin If Application.findcomponent('sjsx')=nil Then Application.CreateForm(Tsjsx, sjsx); sjsx.show; for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin sjsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; sjsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; sjsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; exit; end; end; end; //当选中的字段是数值型浮点或整型时 //数值型字段 if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftfloat) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftinteger) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftbcd)then begin If Application.findcomponent('szsx')=nil Then Application.CreateForm(Tszsx, szsx); szsx.show; for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin szsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; szsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; szsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; exit; end; end; end; end; erp.sx1(ActiveControl.Name,'nxddxh'); dqform:='nxddxh'; dqkj:=ActiveControl.Name;
可以自己做一个 Procedure Terp.sx1(component:string;form:string); var i:integer; begin with application.FindComponent(form) as tform do begin //当选中的字段是STRING类型时 // if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) then if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftwidestring) then begin If Application.findcomponent('zdsx')=nil Then Application.CreateForm(Tzdsx, zdsx); If Application.findcomponent('rqsx')=nil Then Application.CreateForm(Trqsx, rqsx); for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin if pos('期',tdbgrideh(FindComponent(component)).Columns[i].Title.Caption)>0 then begin rqsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; rqsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; rqsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; zdsx.Release; rqsx.show; end else begin zdsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; zdsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; rqsx.Release; zdsx.show; end; exit; end; end; end; //当选中的字段是日期型时 if tdbgrideh(FindComponent(component)).SelectedField.DataType=ftdatetime then begin If Application.findcomponent('sjsx')=nil Then Application.CreateForm(Tsjsx, sjsx); sjsx.show; for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin sjsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; sjsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; sjsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; exit; end; end; end; //当选中的字段是数值型浮点或整型时 //数值型字段 if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftfloat) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftinteger) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftbcd)then begin If Application.findcomponent('szsx')=nil Then Application.CreateForm(Tszsx, szsx); szsx.show; for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do begin if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then begin szsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption; szsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; szsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':'; exit; end; end; end; end;erp.sx1(ActiveControl.Name,'nxddxh'); dqform:='nxddxh'; dqkj:=ActiveControl.Name;
不知该怎么使用...
新人,刚学DELPHI
之前下载过几个安装包,装完了都找不到,郁闷ing
var i:integer;
begin
with application.FindComponent(form) as tform do
begin
//当选中的字段是STRING类型时
// if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) then
if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftwidestring) then
begin
If Application.findcomponent('zdsx')=nil Then
Application.CreateForm(Tzdsx, zdsx);
If Application.findcomponent('rqsx')=nil Then
Application.CreateForm(Trqsx, rqsx);
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
if pos('期',tdbgrideh(FindComponent(component)).Columns[i].Title.Caption)>0 then
begin
rqsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
rqsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
rqsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
zdsx.Release;
rqsx.show;
end
else
begin
zdsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
zdsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
rqsx.Release;
zdsx.show;
end;
exit;
end;
end;
end;
//当选中的字段是日期型时
if tdbgrideh(FindComponent(component)).SelectedField.DataType=ftdatetime then
begin
If Application.findcomponent('sjsx')=nil Then
Application.CreateForm(Tsjsx, sjsx);
sjsx.show;
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
sjsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
sjsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
sjsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
exit;
end;
end;
end;
//当选中的字段是数值型浮点或整型时
//数值型字段
if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftfloat) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftinteger) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftbcd)then
begin
If Application.findcomponent('szsx')=nil Then
Application.CreateForm(Tszsx, szsx);
szsx.show;
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
szsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
szsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
szsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
exit;
end;
end;
end;
end;
erp.sx1(ActiveControl.Name,'nxddxh');
dqform:='nxddxh';
dqkj:=ActiveControl.Name;
Procedure Terp.sx1(component:string;form:string);
var i:integer;
begin
with application.FindComponent(form) as tform do
begin
//当选中的字段是STRING类型时
// if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) then
if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftstring) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftMemo) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftFixedChar) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftwidestring) then
begin
If Application.findcomponent('zdsx')=nil Then
Application.CreateForm(Tzdsx, zdsx);
If Application.findcomponent('rqsx')=nil Then
Application.CreateForm(Trqsx, rqsx);
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
if pos('期',tdbgrideh(FindComponent(component)).Columns[i].Title.Caption)>0 then
begin
rqsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
rqsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
rqsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
zdsx.Release;
rqsx.show;
end
else
begin
zdsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
zdsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
rqsx.Release;
zdsx.show;
end;
exit;
end;
end;
end;
//当选中的字段是日期型时
if tdbgrideh(FindComponent(component)).SelectedField.DataType=ftdatetime then
begin
If Application.findcomponent('sjsx')=nil Then
Application.CreateForm(Tsjsx, sjsx);
sjsx.show;
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
sjsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
sjsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
sjsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
exit;
end;
end;
end;
//当选中的字段是数值型浮点或整型时
//数值型字段
if (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftfloat) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftinteger) or (tdbgrideh(FindComponent(component)).SelectedField.DataType=ftbcd)then
begin
If Application.findcomponent('szsx')=nil Then
Application.CreateForm(Tszsx, szsx);
szsx.show;
for i:=0 to tdbgrideh(FindComponent(component)).Columns.Count-1 do
begin
if tdbgrideh(FindComponent(component)).Columns[i].FieldName=tdbgrideh(FindComponent(component)).SelectedField.FieldName then
begin
szsx.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption;
szsx.Label1.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
szsx.Label2.Caption:=tdbgrideh(FindComponent(component)).Columns[i].Title.Caption+':';
exit;
end;
end;
end;
end;erp.sx1(ActiveControl.Name,'nxddxh');
dqform:='nxddxh';
dqkj:=ActiveControl.Name;
谁能提供一下示例...谢谢!