slide in form

Started by Marc van Cauwenberghe, June 06, 2013, 05:57:38 AM

Previous topic - Next topic

Marc van Cauwenberghe

Hi,
I would like to slide in a child form on to the main form for example from the left. How would I do that.
I suppose I will have to use the annimatewindow api but I do not know how?

Any help.

Marc

Eddy Van Esch

How about simply using :

'hForm = handle of child form
nTop = 100
for nLeft = -400 to 250
   FF_Control_SetLoc( hForm,  nLeft,  nTop )
   sleep 100
next


Haven't tested this though ...

Kind regards
Eddy

Marc van Cauwenberghe

Thank you Eddy for the suggestion. Unfortunately this gives a lot of flickering.

Regards,
Marc

Eddy Van Esch

#3
Maybe you can reduce flicker a little bit by intercepting the WM_PAINT message of the child form.
In WM_PAINT, return 0 and do nothing else there, so no repainting is done.
if you have moved the child form one step (and after SLEEP), let WM_PAINT not return 0 anymore so Windows does the repainting for you. Then call UpdateWindow function.

Otherwise, you might have to do some double buffering. Do the sliding in in a hidden window and BitBlit to the front window...
Eddy

Marc van Cauwenberghe

Thanks again Eddy. But that is really way out of my league.
So much info. ??? ::) :-[

Marc

Eddy Van Esch

I don't have much time  now but if you could zip up a 'minimal code' example using the FF_Control_SetLoc method, maybe I can try out a few things.
Eddy

Marc van Cauwenberghe

Ok, thanks for your help.

Marc

Eddy Van Esch

Hi Marc

I added about 8 buttons to your child form, to better notice flicker.
I didn't think it was that bad really. On my box the button texts are just a bit blurry while moving, no real flicker.
I could not achieve a significant improvement playing with WM_PAINT.
For a real improvement you would need to use double buffering. But I have never used that myself. Sorry ...

Kind regards
Eddy

Marc van Cauwenberghe

Thanks anyway Eddy.
It keeps supprising me that graphic things are so difficult to do and achieve under windows.

Best regards,
Marc

Robert Eaton

I don't know if this is any better or not.
I move the form in its own thread.
Also turned on WS_CLIPCHILDREN on the child form.
Any of these stutter if you move the mouse while the form is moving.


Marc van Cauwenberghe

#10
Hi Robert,

that looks better on my machine. Thank you.
I attached a variation on the project with Slide In en Slide Out.
Now look what happens when you Slide In - Slide out - Slide in.
I do not know anything about threads so this must be related to that I think.

Best regards,
Marc

Robert Eaton

The code in the thread is running all of the time as a separate process until you either exit the program or add code to stop the thread. So in your version the form was trying to slide in and out at the same time.

So here is a quick modification to the previous program. I just added a global variable to indicate the direction the form is moving.

Marc van Cauwenberghe

Thank you Robert and Eddy.
Very logical if you look at it. I learned something today. Thank you again.

Have a  very nice weekend!
Marc