Re: Manipulating viewport in scrolled window



John Cupitt wrote:
> 
> Hi Simon,
> 
> gtk_adjustment_set_value() just emits the "value_changed" signal, so objects
> listening for stuff on this adjustment will only look to see if the value field
> has altered.
> 
> You've altered a bunch of stuff, so you need the full "changed" signal. I'd do:
> 
>         adj->lower = small;
>         adj->upper = big - window_size; // is this is right?
>         adj->page_size = window_size;
>         adj->value = small + (big - small) / 2 - window_size / 2;
>         gtk_adjustment_changed( adj );
> 
> You obviously need to do this after you connected everything up.

Hmm. Perhaps I'm missing something to do with "after you connected..."
then because I'm still getting the same problem - the scrollbars are
scrolling to the correct point (adj->upper should just be 'big' BTW)
but the window view remains resolutely at (0,0). 

I put 

   for (int i=0; i<255; i++)
    	_map.map[i*3 + 3*(i*_map.w)] = 255-i;
 
into the RGB buffer generator, and you can indeed see a fading red 
diagonal line even though the scrollbars are positioned halfway along
the X & Y troughs.

The rendering code is definately being called before the draw code,
and the windows are all realised by the time the gtk_adjustment_changed
is called (The debug output looks like:

Connecting .....
Version is 4.2.10, world is 128x64
Rendered data to RGB buffer
Drawing now!
Drawing now!

The second 'Drawing now!' is because I put an explicit draw into the
startup code, once everything else is initialised. I get a subsequent
'Drawing Now!' every time I scroll the scrollbars with the mouse.

So, basically the adjustments are not scrolling the drawing_area widget.
This is very frustrating because I'm getting the adjustments to use 
from the construct:

GtkAdjustment *adj;
adj = gtk_scrolled_window_get_hadjustment((GtkScrolledWindow *)mapWin);

etc.


Anyone else had a similar problem ?

Cheers,
	Simon.




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