TTMSFNCTabSet / TTMSFNCPageContr

Hi TMS team,
I hope you are going well during this confinement time.
Thanks for the great job with the FNC libraries.

Questions about TTMSFNCTabSet / TTMSFNCPageControl
1. Closing Tab/Page
The user can close a tab/Page by clicking the close button on each tab.
This is correctly triggering the OnBeforeClosePage event allowing me to perform some actions before deleting the tab/page.

I'd like to close a tab/page by code.
For the moment, I am using the Tabset.RemoveTab(Index) or PageControl.RemovePage(Index) methods.
Unfortunately, the OnBeforeClosePage event is not triggered. So, my post process is not executed.

Is there a way to close a tab/page but also trigger the OnBeforeClosePage event?

2. Close Button
The close button on the tab is almost not visible on my tab.
I changed the TTMSFNCPageControl.ButtonAppearance.CloseIcon for another image. But the result is the same. This is only well visible when the mouse is over the close button
What am I doing wrong ?


Thanks
1) Events are only executed when performing an interaction. When programmatically closing a page the event is not triggered, because you know exactly which page is being closed and thus you can also execute the code in the OnBeforeClosePage programmatically after before or after deleting the page.

2) The CloseIcon property is not used for the tab but for the tab list at the right side when setting Options.CloseMode to tcmMenu. When setting the Options.CloseMode to tcmTab, the close is custom drawn and not an icon. This can be overriden with the OnBeforeDrawTabCloseButton and can be customized to a close icon of choice, or custom drawing. Below is a sample:



procedure TForm1.TMSFNCPageControl1BeforeDrawTabCloseButton(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ATabIndex: Integer; ARect: TRectF;
  AState: TTMSFNCTabSetButtonState; var ADefaultDraw: Boolean);
begin
  AGraphics.Stroke.Color := gcWhite;
end;

Sometimes, your nose is too close with the code that you don't see the obvious anymore.
Thanks.

Much better indeed


Great !