Injecting a scrollbar into the toolbox

316 views
Skip to first unread message

Ahana Ghosh

unread,
Oct 31, 2022, 7:51:18 AM10/31/22
to Blockly
Hi, 

Is there a way to enable a "scrollbar" only for the toolbox, and not the workspace, in the current build of blockly? Currently, the options only allow for enabling/disabling scrollbars for the workspace. 

Thanks,
Ahana

Beka Westberg

unread,
Oct 31, 2022, 10:58:51 AM10/31/22
to blo...@googlegroups.com
Hello Ahana!

I believe scrollbars should be enabled in the flyout regardless of the workspace settings (as long as the flyout actually has enough blocks that it needs to be scrolled). Is this the behavior you're seeing, or are you getting something different?

Hopefully with a bit more info we can get this figured out!
--Beka

--
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/41106840-4a10-499e-8f2a-4b810ee6fc68n%40googlegroups.com.

Ahana Ghosh

unread,
Oct 31, 2022, 11:38:13 AM10/31/22
to blo...@googlegroups.com
Hi Beka!

The scrollbars are enabled in the "Workspace" via the options I passed into the BlocklyInterface.injectBlockly() function. However, I want a separate scrollbar for the "Toolbox" which is always visible. Is there a way to achieve this?
BlocklyInterface.injectBlockly({
maxBlocks: Maze.MAX_BLOCKS_INTERFACE,
rtl: rtl,
trashcan: false,
zoom: {
controls: false,
wheel: false,
startScale: scale,
},
move: {
scrollbars: {
"horizontal": false,
"vertical": true,
},
},
});
Currently, my toolbox looks like this: (The scrollbar div exists -- checked via the dev tools -- but somehow doesn't show up when I alter the screen size)

temp.png

I want it to look like (with the scrollbar for the toolbox always visible):
image.png

Thanks,
Ahana

Beka Westberg

unread,
Oct 31, 2022, 12:15:32 PM10/31/22
to blo...@googlegroups.com
Hello again Ahana =)

If you really want to you should be able to register a vertical flyout:

```
Blockly.registry.register(Blockly.registry.FLYOUTS_VERTICAL_TOOLBOX, registry.DEFAULT, MyVerticalFlyoutClass);
```

This will allow you to create a subclass which has a scrollbar that is always visible.

But I'm a bit confused about what you want the scrollbar to look like if the flyout doesn't have enough blocks to be scrollable.

I hope that helps! If you have any further questions please reply :D
--Beka

Ahana Ghosh

unread,
Oct 31, 2022, 12:28:38 PM10/31/22
to blo...@googlegroups.com
Hi Beka!

Thanks for the prompt response! I see your point about the display of the scrollbar when the flyout does not have enough blocks to be scrollable. However, even in the case that it does (I reduced the screen size and checked), somehow my scrollbar doesn't show up 😅

Thanks and Regards,
Ahana

Beka Westberg

unread,
Oct 31, 2022, 12:47:32 PM10/31/22
to blo...@googlegroups.com
Huh! That is weird. It definitely appears to be showing up for me when I resize the window :/ Are you getting any messages in the console?

Best wishes,
--Beka

Screen recording 2022-10-31 9.44.07 AM.webm

Ahana Ghosh

unread,
Oct 31, 2022, 1:47:38 PM10/31/22
to blo...@googlegroups.com
No error messages on the console either. I use some tailwind.css in my code base for modifying some elements of remaining screen, but northing on the blockly-div. Which specific event listener detects the scrolling action by the mouse on the toolbox? Because, I see the scrollbar element (upon inspecting the screen elements) on the screen, but somehow no scrolling is possible. Maybe I am missing the link with the right event listener?

Ahana Ghosh

unread,
Oct 31, 2022, 2:12:20 PM10/31/22
to blo...@googlegroups.com
Hi Beka,

Attached is a screen recording for your reference.

Thanks a lot!
Ahana
screen-recording.mov.zip

Neil Fraser

unread,
Oct 31, 2022, 2:25:46 PM10/31/22
to blo...@googlegroups.com
Is there a place where we can see this online?  Being able to poke at it briefly would be very helpful.



--
Neil Fraser, Switzerland
https://neil.fraser.name

Ahana Ghosh

unread,
Oct 31, 2022, 2:28:11 PM10/31/22
to blo...@googlegroups.com

Hi Neil!

We haven’t made the app public yet. But I could share the link with you privately. Could share any means through which I may do that?

Thanks!
Ahana 

Neil Fraser

unread,
Oct 31, 2022, 2:30:46 PM10/31/22
to blo...@googlegroups.com
Sure, just email myself or Beka off this group.

Avery Word

unread,
Nov 3, 2022, 9:20:18 AM11/3/22
to blo...@googlegroups.com
what are you takling about?

Reply all
Reply to author
Forward
0 new messages