You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Notification delegates for individual Panels and Tabs #17
OnPanelClosed and OnTabClosed works globally for all panels/tabs.
I would love to be able to define different delegate methods for different tabs. This way I could specify individual behavior on close or even make some tabs closeable and others not.
Sadly I'm not experienced with C# delegates so I'm having a hard time thinking of a workaround that works for me.
I think it is quite "hacky" because it does not use the PanelNotificationCenter which was originally intended for this purpose.
An the behavior becomes unpredictable if used together with the PanelNotificationCenter.OnTabClosed.
For example if you happen to use both at some point:
The tab will always be closed and the text won't ever show. But the same unpredictability can happen if you register multiple Delegates so maybe this is simply the responsibility of the developer.
Activity
yasirkula commentedon Jan 21, 2022
Thank you for the feature request! I probably won't be able to add this feature in the near future, though.
FSanta commentedon Jan 22, 2022
Thanks for the response!
Here is my current workaround - I had to make changes to the source of the plugin which could break the existing functionality:
PanelTab - Add a new Method:
PanelNotificationCenter#TabIDChanged
Disable the call to ChangeCloseButtonVisibility so it won't hide the close button again
An example listener that simply destroys the tab if the Button is Clicked:
For Panels the changes should be very similar
Obviously, this solution is quite flawed but it is a simple workaround that will do the trick for me :)
yasirkula commentedon Jan 22, 2022
Looks neat! What are its known flaws?
FSanta commentedon Jan 22, 2022
I think it is quite "hacky" because it does not use the PanelNotificationCenter which was originally intended for this purpose.
An the behavior becomes unpredictable if used together with the PanelNotificationCenter.OnTabClosed.
For example if you happen to use both at some point:
The tab will always be closed and the text won't ever show. But the same unpredictability can happen if you register multiple Delegates so maybe this is simply the responsibility of the developer.