Auto Scroll Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Auto Scroll

Post by priyank_bolia »

I have a VScrollWindow in which I add many panels, with dynamic sizes, which I don't know. I want the window to scroll automatically to adjust all the panels. Currently the bottom panels are not visible.
eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco »

I'm not quite sure what you mean by "I want the window to scroll automatically to adjust all the panels. Currently the bottom panels are not visible." Could you expand on that?

If you mean that the wxVScrolledWindow isn't using the correct sizes, make sure your overload of OnGetLineHeight() returns the size of the window that represents that line.
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

I know about the OnGetLineHeight, but the problem is that I don't have lines, instead in the sizer of the wxVScrolledWindow window, I add many panels with dynamic sizes (which I don't know), and I want the wxVScrolledWindow to scroll automatically to display all the panels.
eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco »

wxVScrolledWindow actually has problems with children layed out using a sizer. I've address these problems in a patch but it hasn't been applied yet.

You should be able to query the actual windows about their size. Something like parent_window->GetChildren(), parent_window->GetSizer->GetItem() (not sure how to get the maximum item index from a sizer though...), or just keeping your own list of the controls. After that, you can just call GetSize().GetHeight() on the correct window and return that in OnGetLineHeight().
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

Code: Select all

wxCoord CVScrollWindow::OnGetLineHeight(size_t n) const
{
	return GetSizer()->GetItem(n)->GetSize().GetHeight();
}
Post Reply