上面的做到了,如何得到选中的 表格数值呢?
试了下面的代码 都不满意
[Delphi] 纯文本查看 复制代码 unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids,
Vcl.ValEdit, Vcl.StdCtrls;
type
TForm1 = class(TForm)
ValueListEditor2: TValueListEditor;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure ValueListEditor2Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
for I := 0 to ValueListEditor2.RowCount - 1 do
ShowMessage(ValueListEditor2.Keys[I]);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
txt: string;
begin
txt := 'key1=value1' + #13 + 'key2=value2' + #13 + 'key3=value3';
ValueListEditor2.Strings.Text := txt;
showmessage(ValueListEditor2.Strings.Text);
end;
procedure TForm1.ValueListEditor2Click(Sender: TObject);
var
str: string;
begin
// str := ValueListEditor2.keys[3];
// ShowMessage(str);
ShowMessage(ValueListEditor2.Keys[ValueListEditor2.row]);
ShowMessage(ValueListEditor2.Cells[1, 2]);
ShowMessage(ValueListEditor2.Strings.Text);
end;
end.
|