Strange behaviour with scrollbars.

I'm using two scrollbars to scroll around a larger 'virtual' area in a smaller 
drawing_area. Sometimes the virtual area size changes, and this has caused 
some confusion for me because of a strange behaviour that sometimes shows.

If i view the whole virtual area, and then it grows to the left i just change 
the parameters in the GtkAdjustment (but leave value as it is) and emit the 
"changed" signal on it. But even though i didn't change 'value' it is still 
set to adjustment->lower by gtk.

I tracked it down to gtk_range_adjustment_changed() in gtkadjustment.c. It 
  if (((range->old_lower != adjustment->lower) ||
       (range->old_upper != adjustment->upper) ||
       (range->old_page_size != adjustment->page_size)) &&
      (range->old_value == adjustment->value))
      if ((adjustment->lower == adjustment->upper) ||
          (range->old_lower == (range->old_upper - range->old_page_size)))
          adjustment->value = adjustment->lower;
          gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
I don't understand why it checks if "(range->old_lower == (range->old_upper - 
range->old_page_size)". Is this right? Doesn't it mean that if the slider was 
to the right, set it to the left, which seems strange.

/ Alex

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]