Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How do I add scrollbars to a dialog
How do I add scrollbars to a dialog [message #51985] Sun, 30 June 2019 14:46 Go to next message
awksed is currently offline  awksed
Messages: 42
Registered: April 2012
Member
I have a TopWindow derived dialog with (currently) empty layout and StaticText and ArrayCtrl controls inserted with new and Add().

The dialog is resizable.

I wish to allow controls hidden by the resizing to be scrolled into view.

I added to the dialog ctor:

AddFrame(m_Sb); // (ScrollBars m_Sb;)

m_Sb.HideX();
m_Sb.WhenScroll = [=] { Ctrl::Refresh(); };

but no joy (no scrollbar appears).

How do I do this?

Thanks.
Re: How do I add scrollbars to a dialog [message #51997 is a reply to message #51985] Mon, 01 July 2019 12:37 Go to previous message
awksed is currently offline  awksed
Messages: 42
Registered: April 2012
Member
Got a little further with this. V scrollbar appears ok but client ArrayCtrl and StaticText controls are not redrawn.

How do I get the visible area to redraw on scrolling?

MyDlg::MyDlg()
{
AddFrame(m_Sb); // (ScrollBars m_Sb;)

m_Sb.HideX();
m_Sb.WhenScroll = [=] { Ctrl::Refresh(); };
}

void MyDlg::Init()
{
.
.
.
Size S = {0, nWindowHeight};

m_Sb.SetTotal(S);
m_Sb.SetPageY(nWindowHeight); // No scrollbar initially
m_Sb.SetLine(0);
}

void MyDlg::Layout()
{
m_Sb.SetPageY(GetRect().GetSize());
}
Previous Topic: [SOLVED] Lib Curl undefined reference
Next Topic: [SOLVED] Invalid memory access on ImageDraw::Init (X11)
Goto Forum:
  


Current Time: Tue Jan 26 23:06:25 CET 2021

Total time taken to generate the page: 0.01409 seconds