Add scrolling to RhinoUIDockbar

I’m trying to add scrolling capabilities to a CRhinoUIDockbar. I’d use the CRhinoTabbedDockBarDialog with scrolling provided in the Rhino5Samples for C++, but the Dockbar has to be docked at the bottom of the screen and to my understanding this is not possible with the CRhinoTabbedDockbarDialog.

As far as I was able to find, scrolling is already possible with normal user controls (e.g. buttons), but I’m drawing content on the dockbar so the built in scrolling functionality doesn’t work.

My idea was to add a “panel” (created as a resource and implemented as a borderless CDialog) to the CRhinoUIDockbar, use it as a canvas to draw on and let the dockbar handle the scrolling, but I’m not able to display it at all.

Panel constructor:

PanelCanvas::PanelCanvas(CWnd* pParent) : CDialog(PanelCanvas::IDD, pParent) {
	Create(IDD_PANELCANVAS, pParent);
}

Dockbar constructor:

panelCanvas = new PanelCanvas(this);
m_scrollHelper = new ScrollHelper();
m_scrollHelper->AttachWnd(this);
CRect drawing_area;
GetClientRect(&drawing_area);
m_scrollHelper->SetDisplaySize(drawing_area.Width(), drawing_area.Height());
panelCanvas->ShowWindow(SW_SHOW);

I’d be grateful for any ideas or suggestions as to what I’m doing wrong or point me in another direction alltogether.

Thanks in advance!

1 Like

Hi Lukas,

I’ve updated the SDK sample to use a dialog scrolling helper class that I wrote some time ago. Let me know if this helps.

https://github.com/mcneel/Rhino5Samples_CPP/tree/master/SampleDockbar

– Dale

1 Like

Hi Dale,

thank you so much, I followed your example and implemented it into my code and it works wonderfully!

For documenting purposes, the way I “enabled” the scrollbars without controls:
I just have to call the following code whenever I expand the drawing, where displaySize is a CRect describing the height and width of the whole content (not only the visible one):

m_scroller->SetDisplaySize(displaySize);