Question

I want to add a widget to the bottom of a scrolled window, then scroll to the bottom of that window. However, the window thinks it is already at the bottom, because the widget has still not been allocated. I.e., this returns -1:

widget.get_allocation().y

Why is this? Is there any way to force the widget to be allocated immediately, so I can adjust the window accordingly? Or is there a better solution?

Was it helpful?

Solution

The better solution is to hook up to the widget's size-allocate signal and defer your scrolling calculation until then.

OTHER TIPS

I'm not 100% sure I understand what you're trying to do, but still: At a minimum, you need to realize the widget to get it to compute those things. But see the note in the linked-to documentation, and investigate if those ways don't work better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top