表格文档多选例子[信息]
//字段事件上
procedure TBGWDDXLZ.FIELD_BizTaskData_ESField01ButtonClick(Sender: TObject);
var
lKHDXCT: TKHDXCT;
begin
lKHDXCT := TKHDXCT.Create(context);
try
[U][B]lKHDXCT.lStr := 'LJL';[/B] [/U]
lKHDXCT.ShowModal;
finally
lKHDXCT.Free;
end;
end;
客户多选窗体
unit KHDXCT;
interface
uses
Business.System, Business.Forms, Business.Model, Business.Data;
type
TKHDXCT = class(TForm)
DataNavigator1: TDataNavigator;
DataGrid1: TDataGrid;
InfoBroker1: TInfoBroker;
dsbRYXX: TDataSetBroker;
DataGrid1FID: TDataGridColumn;
DataGrid1FDEPTID: TDataGridColumn;
DataGrid1ESEX: TDataGridColumn;
DataGrid1FDISPLAYNAME: TDataGridColumn;
DataGrid1ERESIDENCE: TDataGridColumn;
DataGrid1Select: TDataGridColumn;
Panel1: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
dsbBizTaskData: TDataSetBroker;
procedure BizFormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BizFormShow(Sender: TObject);
private
{private declarations}
procedure init;
public
{public declarations}
lStr : String;
end;
implementation
procedure TKHDXCT.BizFormCreate(Sender: TObject);
begin
dsbRYXX.DataSet.Open;
init;
end;
procedure TKHDXCT.init;
var
i: integer;
begin
dsbRYXX.DataSet.DisableControls;
dsbRYXX.DataSet.First;
try
for i := 0 to dsbRYXX.DataSet.RecordCount do
begin
dsbRYXX.DataSet.Edit;
dsbRYXX.DataSet.FieldByName('Select').AsInteger := 0;
dsbRYXX.DataSet.Next;
end;
finally
dsbRYXX.DataSet.EnableControls;
dsbRYXX.DataSet.First;
end;
end;
procedure TKHDXCT.BitBtn1Click(Sender: TObject);
var
i: integer;
lPersonList: string;
begin
dsbRYXX.DataSet.DisableControls;
dsbRYXX.DataSet.First;
try
for i := 0 to dsbRYXX.DataSet.RecordCount do
begin
if dsbRYXX.DataSet.FieldByName('Select').AsInteger = 1 then
begin
lPersonList := lPersonList + ',' + dsbRYXX.DataSet.FieldByName('FDISPLAYNAME').asString;
end;
dsbRYXX.DataSet.Next;
end;
if lPersonList <> '' then
begin
lPersonList := stringutils.Copy(lPersonList,2,length(lPersonList));
dsbBizTaskData.DataSet.Edit;
dsbBizTaskData.DataSet.FieldByName('ESField01').AsString := lPersonList;
dsbBizTaskData.DataSet.Post;
end;
finally
dsbRYXX.DataSet.EnableControls;
end;
end;
procedure TKHDXCT.BitBtn2Click(Sender: TObject);
begin
Close;
end;
[U][B]procedure TKHDXCT.BizFormShow(Sender: TObject);[/B] [/U]
begin
if lStr <> '' then
begin
//过滤出FID为lStr数值的数据
dsbRYXX.DataSet.Filtered := False;
dsbRYXX.DataSet.Filter := ' FID = ''' + lStr + '''';
dsbRYXX.DataSet.Filtered := True;
end;
end;
end. |