Changeset - r17007:ce6e7cbe1b65
[Not reviewed]
master
0 1 0
alberth - 14 years ago 2011-01-09 15:25:33
alberth@openttd.org
(svn r21754) -Codechange: Scroll the matrix widget to make a clicked entry fully visible.
1 file changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -1374,6 +1374,13 @@ void NWidgetMatrix::SetColour(Colours co
 
void NWidgetMatrix::SetClicked(int clicked)
 
{
 
	this->clicked = clicked;
 
	if (this->sb != NULL && this->widgets_x != 0) {
 
		int vpos = (this->clicked / this->widgets_x) * this->widget_h; // Vertical position of the top.
 
		/* Need to scroll down -> Scroll to the bottom.
 
		 * However, last entry has no 'this->pip_inter' underneath, and we must stay below this->sb->GetCount() */
 
		if (this->sb->GetPosition() < vpos) vpos += this->widget_h - this->pip_inter - 1;
 
		this->sb->ScrollTowards(vpos);
 
	}
 
}
 

	
 
/**
0 comments (0 inline, 0 general)