Minor correction to listbox::SetFirstItem so that
it doesn't scroll beyond the legal range. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -803,7 +803,10 @@ void wxListBox::DoSetFirstItem( int n )
|
||||
GtkWidget *item = GTK_WIDGET(target->data);
|
||||
wxCHECK_RET( item, wxT("invalid listbox code") );
|
||||
|
||||
gtk_adjustment_set_value( adjustment, item->allocation.y );
|
||||
float y = item->allocation.y;
|
||||
if (y > adjustment->upper - adjustment->page_size)
|
||||
y = adjustment->upper - adjustment->page_size;
|
||||
gtk_adjustment_set_value( adjustment, y );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -803,7 +803,10 @@ void wxListBox::DoSetFirstItem( int n )
|
||||
GtkWidget *item = GTK_WIDGET(target->data);
|
||||
wxCHECK_RET( item, wxT("invalid listbox code") );
|
||||
|
||||
gtk_adjustment_set_value( adjustment, item->allocation.y );
|
||||
float y = item->allocation.y;
|
||||
if (y > adjustment->upper - adjustment->page_size)
|
||||
y = adjustment->upper - adjustment->page_size;
|
||||
gtk_adjustment_set_value( adjustment, y );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user