2
Well I’m a beginner and I’m in big trouble.
I have the following situation:
I create an item on Tlistview
by making two clicks on the selected item I add an object in the form
to the item of listview
and create a form
with parent
at the Tabsheet
.
In this case what I’m not getting is to relate the Tabsheet
to the item when I close the form
or delete the item. I was able to do just by adding the handle
of Tabsheet
to the selected item, I do the loop of handle
to identify which tabsheet
this related to the item.
In the ondblclick
of listview
:
LV1.Selected.SubItems[1]:=IntToStr(NewTabSheet.Handle);
LV1.Selected.SubItems.Objects[3] := TObject(NewTabSheet);
In the onChange
of PageControl
I try to identify the tabsheet
:
procedure TForm1.pgc1Change(Sender: TObject);
var
i, c: integer;
begin
try
for i := 0 to lv1.Items.Count -1 do
if i > 0 then
begin
if IntToStr(pgc1.ActivePage.Handle) = Form1.lv1.Items.Item[i].SubItems[1] then
begin
lv1.Items.Item[i].Selected:= True;
Abort;
end;
end;
// ...
Here is when I try to set some item information when I change tabsheet
:
procedure TForm1.SENDTEXT(txt:string;NUM:INTEGER);
var
i,c:integer;
begin
for i := 0 to Form1.LV1.Items.count - 1 do
begin
if form1.lv1.Items[i].SubItems[1] = inttostr(pgc1.ActivePage.Handle) then
begin
(form1.lv1.Items[i].SubItems.Objects[2]as TForm2).StatusText.Panels[NUM].Text:=txt;
end;
end;
end;
Correct me because I’m getting lost in the code, I think my method is wrong!
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero