DocumentWindow move & repaint problem


#1

Hi there,

I’m having a little issue when I resize my contentcomponent and move the DocumentWindow at the same time

I don’t want just to resize the ContentComponent of my app, I want to move the DocumentWindow that holds it so a certain part of my ContentComponent is in an specific position of the screen.
So if my window goes from:

[LLLLLL][C][RRR]
    [LL][C][RRRRR]

(you see the center bit is in the same position but for that i have to move my Document Window

I try to do it this way

myContentComponent->setSize(newWidth, newHeight);
		
Component* p = myContentComponent->getParentComponent();
if (p) p->setTopLeftPosition(newXposition), p->getScreenY());

The thing is that doing it that way i think the window is repaint twice (one for the resize of the component and other for moving it). What I would like to do is everything at the same time so I don’t get a blink on the app.

I don’t know if that’s possible or I’m being superposh. Any idea so I can have my supercool app? :slight_smile:

Gracias!
A


#2

Hmm, that’s a tricky thing to do - I don’t know which OS you’re using, but they all shift the existing contents of a window when you move it, and then let you redraw afterwards, so you’ll inevitably get that flicker. I’ve really no idea if it’s possible to do anything about it, TBH!


#3

Hi,

I’m using Mac OS X 10.6.4. (at some point I have to recompile it for win as well but one thing at a time)
I was thinking it would be possible cause when I login skype it resize the window slowly. Ok, it doesn’t move it, just resize it, but I don’t get any blinking.

So how I’m doing it is the proper way to do it, isn’t it?

A


#4

Resizing is easy to do cleanly, as long as the top-right corner stays still - you very very rarely see a window expand upwards or leftwards keeping the bottom-right still.

You’d probably be better off not using a DocumentWindow, because it’ll do all sorts of faffing about internally, which may end up not being ideal for this, so maybe try it with a simpler component to see if that works better.