About the last changes in the Viewport class


#1

Hi Jules,
with the latest tip, in Viewport::updateVisibleArea() you added at line 225:

    else
    {
        visibleOrigin.setX (0);
    }

and at line 238:

    else
    {
        visibleOrigin.setY (0);
    }

This is giving me some headaches, since I’m using a viewport with invisible scrollbars and I need to set its viewed positions from outside.


#2

…ok, but if it’s not got scrollbars, and if you’re setting the position externally, why are you using a Viewport at all? Couldn’t you do the same thing by just putting one component inside another and moving it around?


#3

Yes, I suppose I can do that.
Could you add a comment in setViewPosition informing that the method will always set the position to 0 if the scrollbars aren’t visible?


#4

In fact, it should probably do this:

else if (canShowHBar) { visibleOrigin.setX (0); }

…so it’d probably work for you. But if you don’t want anything else to mess with the position of your content, a viewport’s probably not the right kind of container for it.


#5

Well, this last solution would be perfect, so I wouldn’t lose the autoScroll functionality.


#6

Erm… sorry to bother you again,
I just tried the last additions and now I’m getting an invalid rectangle when overriding visibleAreaChanged.
The viewport that overrides visibleAreaChanged has visible scrollbars.


#7

Ok, I’ll take a look.


#8

No… can’t see anything wrong with that, it looks to me like it’s just going to be returning the same coords it always did. Can you be more specific?


#9

Argh! Sorry, my fault, I didn’t clean up the project before rebuilding it!
I was getting a segfault when trying to access the Rectangle’s coordinates…
Again, sorry and thank you for your time.