I'm a beginner and I have a big problem.
I have the following situation:
I create an item in Tlistview
by giving two clicks on the selected item I add an object in the case form
to the item listview
and I create a form
with parent
to Tabsheet
.
In case what I'm not getting is to relate the Tabsheet
to the item when I'm closing the form
or deletes the item. I was able to do just by adding the handle
of Tabsheet
to the selected item, I do the loop of the handle
to identify which tabsheet
is related to the item.
No ondblclick
of listview
:
LV1.Selected.SubItems[1]:=IntToStr(NewTabSheet.Handle);
LV1.Selected.SubItems.Objects[3] := TObject(NewTabSheet);
No onChange
of PageControl
I try to identify 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 from 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!