Scrollable Pane Child Windows not Offsetting
Moderators: CEGUI MVP, CEGUI Team
- malachy1681
- Just popping in
- Posts: 19
- Joined: Thu Sep 01, 2005 05:29
- Contact:
Scrollable Pane Child Windows not Offsetting
Okay, I have a frame window with a scrollable pane as a child. Then I have a tab control as a child of the scrollable pane, but when I set an offset (either absolute or relative) the tab control always lines up at 0, 0 relative to the scrollable pane. I'm using the source download of 0.4.0 and the Falagard system. Any help here would be greatly appreciated.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Scrollable Pane Child Windows not Offsetting
I think you're seeing the pane "auto size" itself.
By default, if the total content does not exceed the bounds of the viewing pane, the position/size will auto-adjust so that the content appears as if to be at (0,0).
You either need to add content that exceeds the size of the view area, or disable the auto-sizing of the content pane via setContentPaneAutoSized, and then get the content pane, and set its size explicitly.
By default, if the total content does not exceed the bounds of the viewing pane, the position/size will auto-adjust so that the content appears as if to be at (0,0).
You either need to add content that exceeds the size of the view area, or disable the auto-sizing of the content pane via setContentPaneAutoSized, and then get the content pane, and set its size explicitly.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- malachy1681
- Just popping in
- Posts: 19
- Joined: Thu Sep 01, 2005 05:29
- Contact:
Re: Scrollable Pane Child Windows not Offsetting
Well, now the problem I'm having is that 'getContentPane' returns a const pointer which doesn't allow me to set its size.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Scrollable Pane Child Windows not Offsetting
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- malachy1681
- Just popping in
- Posts: 19
- Joined: Thu Sep 01, 2005 05:29
- Contact:
Re: Scrollable Pane Child Windows not Offsetting
Okay, got it all worked out now. Thanks a million! 

Re: Scrollable Pane Child Windows not Offsetting
Hmmm. I'm having the same problem. I am trying to display some StaticImage windows inside a ScrollablePane (icons) and the scrollable pane keeps stacking my Icons, even after I do the above..
Here is where I create the pane:
and here is where I try to align my icons.
Now, if I use DefaultWindow instead of ScrollablePane, my icons align without a problem. It only occurs when I use the scrollable pane type window.
Any suggestions?
Here is where I create the pane:
Code: Select all
mInventoryWindow = (CEGUI::ScrollablePane *)mWinMgr->createWindow(
(CEGUI::utf8*)CEGUILOOK"/ScrollablePane", (CEGUI::utf8*)mStr);
mInventoryWindow->setMetricsMode(CEGUI::Absolute);
mInventoryWindow->setPosition(CEGUI::Absolute, CEGUI::Point(10.0f, 30.00f) );
mInventoryWindow->setSize(CEGUI::Absolute,
CEGUI::Size(mFrameWindow->getAbsoluteWidth() - 10.0f, mFrameWindow->getAbsoluteHeight() - 40.0f) );
mInventoryWindow->setVisible(true);
mInventoryWindow->setContentPaneAutoSized(false);
mInventoryWindow->setContentPaneArea(
CEGUI::Rect( CEGUI::Point(10.0f, 30.00f),
CEGUI::Size(mFrameWindow->getAbsoluteWidth() - 10.0f, mFrameWindow->getAbsoluteHeight() - 40.0f) ) );
and here is where I try to align my icons.
Code: Select all
for (mCount = 0; mCount < mChildCount; mCount++ )
{
mChild = mInventoryWindow->getChildAtIdx(mCount);
if ( !mChild ) break;
mChild->setPosition(CEGUI::Absolute, CEGUI::Point(mCol * 60.0f, mRow * 60.0f) );
mCol++;
if (mCol > mMaxCol )
{
mRow++;
mCol = 0;
}
} // for
Now, if I use DefaultWindow instead of ScrollablePane, my icons align without a problem. It only occurs when I use the scrollable pane type window.
Any suggestions?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Scrollable Pane Child Windows not Offsetting
The way that ScrollablePane is implemented means that the windows that you attach do not get added to the ScrollablePane itself, but rather to an attached 'ContentPane' window. So you'll need to get that window, and perform from there (since that's where your icons are really attached).
ScrollablePane::getContentPane will return you this window.
ScrollablePane::getContentPane will return you this window.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Scrollable Pane Child Windows not Offsetting
That did it! Works great, thank you!
For future readers:
I changed this line:
to this line
And here is the whole quick and dirty arrange window routine I used:
For future readers:
I changed this line:
Code: Select all
mChild = mInventoryWindow->getChildAtIdx(mCount);
to this line
Code: Select all
mChild = mInventoryWindow->getContentPane()->getChildAtIdx(mCount);
And here is the whole quick and dirty arrange window routine I used:
Code: Select all
void <YOUR CLASS HERE>::WindowInit(void)
{
...
mInventoryWindow = (CEGUI::ScrollablePane *)mWinMgr->createWindow(
(CEGUI::utf8*)CEGUILOOK"/ScrollablePane", (CEGUI::utf8*)mStr);
mInventoryWindow->setMetricsMode(CEGUI::Absolute);
mInventoryWindow->setPosition(CEGUI::Absolute, CEGUI::Point(10.0f, 30.00f) );
mInventoryWindow->setSize(CEGUI::Absolute,
CEGUI::Size(mFrameWindow->getAbsoluteWidth() - 10.0f, mFrameWindow->getAbsoluteHeight() - 40.0f) );
mInventoryWindow->setVisible(true);
mInventoryWindow->setContentPaneAutoSized(false);
mInventoryWindow->setContentPaneArea(
CEGUI::Rect( CEGUI::Point(10.0f, 30.00f),
CEGUI::Size(mFrameWindow->getAbsoluteWidth() - 10.0f, mFrameWindow->getAbsoluteHeight() - 40.0f) ) );
...
} // WindowInit
void <YOUR CLASS HERE>::arrangeItems(void)
{
if ( !mInventoryWindow ) return;
if ( mInventoryWindow->getContentPane()->getChildCount() < 1 ) return;
unsigned int mChildCount=0, mCount=0, mRow=0, mCol=0, mMaxCol=0;
float mFCol=0.0f;
CEGUI::Window *mChild=NULL;
mFCol = mInventoryWindow->getContentPaneArea().getWidth() / 60.0f;
mMaxCol = mFCol;
mFCol = mFCol - mMaxCol;
if ( mFCol > 0.0f ) mMaxCol--;
if ( mMaxCol < 1 ) mMaxCol = 1;
mChildCount = mInventoryWindow->getContentPane()->getChildCount();
for (mCount = 0; mCount < mChildCount; mCount++ )
{
mChild = mInventoryWindow->getContentPane()->getChildAtIdx(mCount);
if ( !mChild ) break;
mChild->setPosition(CEGUI::Absolute, CEGUI::Point(mCol * 60.0f, mRow * 60.0f) );
mCol++;
if (mCol > mMaxCol )
{
mRow++;
mCol = 0;
}
} // for
} // arrangeItems
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 7 guests