CXGrid中获取多行选择的值

Posted on 2023-03-18 11:27  墨者工作室  阅读(94)  评论(0编辑  收藏  举报

if (db_indent.Active) and (cxGridDBTableView2.Controller.SelectedRecordCount > 0) then
begin
_Value := TStringList.Create;
_Value.Clear;

for i := 0 to cxGridDBTableView2.Controller.SelectedRecordCount - 1 do
begin
cxGridDBTableView2.Controller.FocusedRow := cxGridDBTableView2.Controller.SelectedRows[i];

_NNO := db_indent.FieldByName('NNO').AsString; //编号

_Value.Add(_NNO + ' ' + _NA1 + ' ' + _uTY );
end;
try
if _Value.Text <> '' then
begin
_valueText := _Value.Text; //删除 回车,空格,等字符
Clipboard.SetTextBuf(PChar(_valueText));
end;
finally
_Value.Free;
end;
end;

Copyright © 2024 墨者工作室
Powered by .NET 9.0 on Kubernetes