Show and Hide Toolbox programmatically

509 views
Skip to first unread message

Preet Vadaliya

unread,
May 4, 2022, 1:53:51 PM5/4/22
to Blockly
Hi All,

Can anyone tell me how can I hide and show toolbar on button click?

Mark Friedman

unread,
May 4, 2022, 3:33:50 PM5/4/22
to blo...@googlegroups.com
There may be a simpler way, but assuming you have access to the current workspace, something like this should work:

workspace.getToolbox().getFlyout().hide();

-Mark


On Wed, May 4, 2022 at 10:53 AM Preet Vadaliya <preetvada...@gmail.com> wrote:
Hi All,

Can anyone tell me how can I hide and show toolbar on button click?

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/ad76c7f1-6edf-4b08-98bc-0aa20705a981n%40googlegroups.com.

Preet Vadaliya

unread,
May 5, 2022, 2:49:39 AM5/5/22
to Blockly
Hi Mark,

Actually I already tried this but in case of flyout toolbox it wont work, workspace.getToolbox() return null in that case.

Jason Schanker

unread,
May 5, 2022, 4:55:07 AM5/5/22
to Blockly
Hi,

For toolboxes with categories, you could use workspace.getToolbox().setVisible(false) and for toolboxes with just blocks where workspace.getToolbox() will be null, you could use workspace.getFlyout().setVisible(false).

Best,
Jason

Reply all
Reply to author
Forward
0 new messages