Author Topic: Set Panel Scrollable Area  (Read 228 times)

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
I know it's in the name but can I get clarity on what SetPanelScrollableArea is supposed to do?
Like what should I expect MusicBee to do when I've defined the following?

Code
mbApi.MB_SetPanelScrollableArea(panel, new Size(100, 200), true);
I've been working on a quiz plugin for the past few weeks that's near-ready.
I just need to get some scrolling to take place in there if ever the panel size is too small.
Can I rely on that function to get me the scrollbar that's showing up in the 'Upcoming Tracks' panel below or do I just have to add my own scroll control.


Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 33461
as long as the panel used was created with MB_AddPanel using type 1, 2 or 5 then the SetPanelScrollableArea can be used to set the virtual height of the panel and if that value exceeds the actual height then a vertical scrollbar that follows the skin settings should show

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
I've modified the panel passed in by the OnDockablePanelCreated method using MB_AddPanel, but I'm still having no luck I'm afraid.
Below is what I have and according to my understanding of the above:

- this should introduce a vertical scrollbar given that the scrollArea height will always be 100px longer than the actual panel height.
- but whether I've used the below in the OnDockablePanelCreated method or the paint event itself, I'm still unable to get it to appear.

Code
panel = mbApi.MB_AddPanel(panel, (PluginPanelDock)1);
mbApi.MB_SetPanelScrollableArea(panel, new Size(panel.Width, panel.Height + 100), true);
Hope I'm still not misunderstanding how this should be used.
Source files are here in case you may want to have a look.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 33461
Disregard what i said about using MB_AddPanel - its not needed for the type of plugin panel you are using
There is an issue with MB_SetPanelScrollableArea and i should be resolve it

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 33461
https://getmusicbee.com/patches/MusicBee35_Patched.zip
should work if you set MB_SetPanelScrollableArea within OnDockablePanelCreated
only vertical scrollbar is supported though, so make sure the scrollable width is set to 0 or at least less than the panel width

Mayibongwe

  • Hero Member
  • *****
  • Posts: 513
Fantastic. Can confirm all is working fine now.
Thank you Steven...for this and the artist thumb skin image in the other thread.