I Destroy frame with double click on the component TsListView. This frame contains a component which is responsible for the event. Application code:
— First unit —
CurrentFrame: TFrame;
procedure TMainFrame.DeleteFrame
begin
if Assigned(CurrentFrame) then
if CurrentFrame is TAlert then
FreeAndNil(CurrentFrame)
end;
— Secound unit —
procedure TAlert.sListView1Click(Sender: TObject);
begin
TMainFrame(Self.Parent).DeleteFrame;
end;
Error occurs not on DeleteFrame function , but after leaving the sListView.
From my observation is that WM_DESTROY is sent first, and then WM_LBUTTONUP. This causes an error in event handlers TsListView.
I added instructions
if Assigned (FCommonData) then begin
and everything is working properly. The code amendment:
// ================================================================
// sListView.pas – Line 545, Component v. 7.67
if Assigned(FCommonData) then begin
if FCommonData.Skinned then case Message.Msg of // !!! Error here
WM_MOUSEMOVE : if (Win32MajorVersion >= 6) then begin
R.TopLeft := ScreenToClient(acMousePos);
li := GetItemAt(R.Left, R.Top);
if li <> nil then begin
if (HotItem >= 0) and (HotItem < Items.Count) then begin // Repaint prev Hot Item
if li.Index <> HotItem then begin
R := Items[HotItem].DisplayRect(drBounds);
InvalidateRect(Handle, @R, True);
HotItem := -1;
end
end
end;
end;
…..
end;
// ================================================================
Please help
how else can I solve this problem?