Make ComboBox's list draw right

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
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Make ComboBox's list draw right

Post by Sylence »

I noticed that IGUIComboBox draws its drop-down-list under the element in all cases.
This can be bad if the combo box is at the bottom of the screen. The list will than be rendered outside the window so it's not visible.

I fixed this by moving the drop-down-list over the combo box if it would be outside the window.

Add this code in CGUIComboBox::openCloseMenu() after the line "ListBox->drop();"

Code: Select all

		// move listbox up if the box is outside the window
		video::IVideoDriver* Driver = Environment->getVideoDriver();
		r = ListBox->getAbsolutePosition();
		if(r.LowerRightCorner.Y > Driver->getScreenSize().Height)
		{
			ListBox->setRelativePosition(core::rect<s32>(0, -AbsoluteRect.getHeight()-h, AbsoluteRect.getWidth(), 0));
		}
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Post Reply