MÖP es geht - nu auch getestet - n Pointer is doch nix anderes als ne Zahl (Integer? evtl Unsigned?)
Man kann ja auch Objecte an ein xyz.Tag hängen (eben umgekehrt)
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
lv: TListView;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure lvSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Item : TListItem;
begin
item := lv.Items.Add;
Item.Data := Pointer(45);
Item.Caption := '
Test';
end;
procedure TForm1.lvSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
begin
If Assigned(Item)
then
Caption := IntTostr(Integer(Item.Data));
end;
end.