PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Marc van Cauwenberghe on June 06, 2013, 05:57:38 AM

Title: slide in form
Post by: Marc van Cauwenberghe on June 06, 2013, 05:57:38 AM
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
Title: Re: slide in form
Post by: Eddy Van Esch on June 06, 2013, 06:08:19 AM
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
Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 06, 2013, 06:33:35 AM
Thank you Eddy for the suggestion. Unfortunately this gives a lot of flickering.

Regards,
Marc
Title: Re: slide in form
Post by: Eddy Van Esch on June 06, 2013, 07:03:29 AM
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...
Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 06, 2013, 07:46:02 AM
Thanks again Eddy. But that is really way out of my league.
So much info. ??? ::) :-[

Marc
Title: Re: slide in form
Post by: Eddy Van Esch on June 06, 2013, 09:55:23 AM
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.
Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 06, 2013, 11:12:54 AM
Ok, thanks for your help.

Marc
Title: Re: slide in form
Post by: Eddy Van Esch on June 06, 2013, 05:18:14 PM
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
Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 07, 2013, 03:03:33 AM
Thanks anyway Eddy.
It keeps supprising me that graphic things are so difficult to do and achieve under windows.

Best regards,
Marc
Title: Re: slide in form
Post by: Robert Eaton on June 07, 2013, 02:21:55 PM
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.

Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 07, 2013, 04:32:05 PM
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
Title: Re: slide in form
Post by: Robert Eaton on June 07, 2013, 05:13:18 PM
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.
Title: Re: slide in form
Post by: Marc van Cauwenberghe on June 07, 2013, 06:33:28 PM
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