[fixed]CGUIPanel from GUIEditor: scrollbars bringToFront fix

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

[fixed]CGUIPanel from GUIEditor: scrollbars bringToFront fix

Post by puh »

Hi,

i 've used this small nice CGUIPanel class in my app for getting to work multiline text scrolling.

Have found annoying thing - after loading the panel in case of new scrollbars appears they stay behind the content.

Fix is easy:
in CGUIPanel.cpp line 278 and 288 adding this->bringToFront(ScrollBar);
so instead of

Code: Select all

	// scrollbars
	if ( HScrollBarMode != ESBM_ALWAYS_INVISIBLE &&
		(totalRect.getWidth() > outerRect.getWidth() || HScrollBarMode == ESBM_ALWAYS_VISIBLE) )
	{
		HScrollBar->setVisible(true);
		HScrollBar->setMax(totalRect.getWidth() - outerRect.getWidth());
	}
	else
		HScrollBar->setVisible(false);

	if ( VScrollBarMode != ESBM_ALWAYS_INVISIBLE &&
		(totalRect.getHeight() > outerRect.getHeight() || VScrollBarMode == ESBM_ALWAYS_VISIBLE) )
	{
		VScrollBar->setVisible(true);
		VScrollBar->setMax(totalRect.getHeight() - outerRect.getHeight());
	}
	else
		VScrollBar->setVisible(false);
it will be:

Code: Select all

	// scrollbars
	if ( HScrollBarMode != ESBM_ALWAYS_INVISIBLE &&
		(totalRect.getWidth() > outerRect.getWidth() || HScrollBarMode == ESBM_ALWAYS_VISIBLE) )
	{
		HScrollBar->setVisible(true);
		HScrollBar->setMax(totalRect.getWidth() - outerRect.getWidth());
		this->bringToFront(HScrollBar);
	}
	else
		HScrollBar->setVisible(false);

	if ( VScrollBarMode != ESBM_ALWAYS_INVISIBLE &&
		(totalRect.getHeight() > outerRect.getHeight() || VScrollBarMode == ESBM_ALWAYS_VISIBLE) )
	{
		VScrollBar->setVisible(true);
		VScrollBar->setMax(totalRect.getHeight() - outerRect.getHeight());
		this->bringToFront(VScrollBar);
	}
	else
		VScrollBar->setVisible(false);
Hope it could be helpfull,
thank you
Post Reply