I create a TabSheet with Frame and later I try close TabSheet from Button on Frame.
TabSheet := TsTabSheet.Create(APageControl);
TabSheet.PageControl := APageControl;
Frame := TFrame.Create(TabSheet);
SkinManager.UpdateScale(Frame);
Frame.Parent := TabSheet;
APageControl.ActivePage := TabSheet;
Code in Frame:
procedure TFrame_Test.sSpeedButton2Click(Sender: TObject);
begin
if Parent.ClassName = 'TsTabSheet' then
TsPageControl(Parent.Parent).Pages[TsTabSheet(Parent).PageIndex].Free;
end;
TabSheet is closing but i get AV in this line code:
unit sSpeedButton;
procedure TsSpeedButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if [csDesigning, csDestroying] * ComponentState = [] then begin
Application.ShowHint := AppShowHint;
ShowHintStored := False;
if (Button = mbLeft) and Enabled and (ButtonStyle = tbsDropDown) then begin
DroppedDown := False;
TempControl := nil;
end;
inherited;
-> if (FCommonData.PulsTimer <> nil) and FCommonData.PulsTimer.Enabled then
FCommonData.PulsTimer.PrepareImage;
// RestartAttention(SkinData);
end;
end;
AV because FCommonData = nil
Do you have any way to do it?