Page 1 of 1

Perhaps Incorrect getUnclippedInnerRect in ScrollablePane Wi

Posted: Fri Apr 01, 2005 00:50
by daesdemon
Hello,

My problem is that:
I use ScrollPane with scrollBar automaticaly hide if not required.
I would like to know if the scrollbar is visible or not at a time.
The reason is when i get the ScrollablePane InnerUnclippedRect , it seems not to take care of this data, so it always give to me the complete area with the scrollbar area included.
I have to reduce this workable area when the scrollbar is active but i don't know how to know that.

Do someone have a clue?
I see a protected function isVertScrollbarNeeded but as i use wrappers to derive from CEGUI Windows, i cannot access them :(

Re: is the Scrollbar enabled

Posted: Fri Apr 01, 2005 09:04
by Guest
To find your scrollbars, have a look at the children of your scrollable pane. The scrollbars should have the same name as your scrollable pane widget with extention "__auto_hscrollbar__" or "__auto_vscrollbar__" (respectivly horizontal & vertical scrollbar).

Once you have it, just call ->isVisible on it.

But i'm pretty sure the scrollbars' size should be included when calculating the size of the render area. If it's not, then it's probably a bug.

--
Chris

Re: is the Scrollbar enabled

Posted: Fri Apr 01, 2005 12:26
by daesdemon
Thx Chris,
i will test that soon.

I submited it in BugReports.

Re: is the ScrollablePane Scrollbar enabled

Posted: Fri Apr 01, 2005 12:32
by daesdemon
Work Great Chris Thx
[Edit]
Except when i call isVisible() the first time it always seems to answer yes even if it is not, but it can be a bug in my construction routine, i will check it later.

Code to return a correct Workable Rect for ScrollablePane Widget in Window Absolute Coordinate

Code: Select all

Rect getWorkableRect(ScrollablePane* mRoot)
{
Window* vsb = mRoot->getChild(mRoot->getName()+"__auto_vscrollbar__");
Rect r = mRoot->screenToWindow(mRoot->getUnclippedInnerRect());
if (vsb->isVisible()) r.setWidth(r.getWidth()-VSCROLLBAR_WIDTH);
return r;
}

VSCROLLBAR_WIDTH seems to be 15 in WindowsLook

I haven't check for the Horizontal ScrollBar but it is propably the same
[/Edit]