PluginToolbarButton:Destroy() does NOT remove itself from Toolbar

Trying to :Destroy() a PluginToolbarButton does absolutely nothing

I should note that PluginToolbar:Destroy() also does nothing.

Use case:

  • creating disposable PluginToolbarButtons and PluginToolbar
    (showing buttons and are useless at the time is terrible UX)

I’m aware of DockWidgetPluginGui however this is easier to use and some prefer to keep their viewport clean.


Source:

Code
local toolbar = plugin:CreateToolbar("Toolbar")
 
local Button = toolbar:CreateButton("Button","","")
Button.Click:Connect(function()
	Button.Parent = nil
	Button:Destroy()
	warn("Button:Destroy()")
end)

plugin.lua (190 Bytes)


References:


3 Likes

Not sure if related but a while ago some (not all of them) plugins started to glitch when I try to disable them their Toolbar Buttons wont go away. And they also wont work anymore because the plugin is disabled.

Thanks for the report! We’ve filed this internally and we’ll follow up here when we have an update for you.

1 Like

I am in the process of checking over bug reports and following up on some bugs that haven’t received any activity in a while.
Is this issue still occurring or can you confirm that this bug has been resolved?

Yes, I can confirm that this still happens

I’m having this issue currently.

1 Like

Thanks for the info. As soon as there is an update i will pass it on.

2 Likes

This bug still exists and I would make a new topic if I could… But, I can’t.


attempting to call the Destroy method on a PluginToolBar or a PluginToolBarButton

  • The bug is simple, attempting to call the Destroy method on a PluginToolBar or a PluginToolBarButton, it will not destroy it as expected.

  • The bug happens in plugins.

  • No idea when it has happened, but it has been reported before. Making a new post because the post has been inactive for a long while.

  • Screenshots:
    Screen Shot 2021-07-27 at 12.08.14 AM

  • Method of reproduction (can be found in screenshot):
    – Using a plugin, create a toolbar and a button with it.
    – Attempt to call destroy on those instances.

  • Reproduction is 100%.

1 Like

I’m also having issues with this right now.

This continues to be an annoying problem. As someone who is developing plugins as part of a suite, I would rather be able to group them all together under a single toolbar than have separate toolbars with only a single action which simply toggles the pseudo-enabled/disabled state of the said plugin. Currently, I am left with the following if I try to add a button to the bar, then fully deactivate and reactivate a plugin.
image

Honestly, the whole RibbonBar API needs to be redone. Qt Ribbons has tons more features that just buttons.

Where are…

  • Dropdowns
  • Small Buttons
  • Text Boxes
  • Checkboxes
  • Radio Buttons
    …just to name a few

To the OP: Its likely Qt hasn’t be told to react to the instance being destroyed from code