Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animate your Wizard created forms :-) 1

Status
Not open for further replies.

ramani

Programmer
Mar 15, 2001
4,336
AE
Based on what Mike Gagnon direction for animating a pageframe, I just thought of providing a quick code to enable a similar animation to the forms built by VFP form wizard. :)

The steps are detailed below..

Step 1. Cut and copy the following code as ANIPRG.PRG and include this PRG in your project.
******************************************************
******************************************************
** AniPrg.PRG Form animation
******************************************************
LPARAMETER tcDirection, tnHeight, tnLeft, tnTop, tnWidth

Local jnAt As Integer, myForm As Object, ;
nDuration as Integer, jnHwnd AS Integer
nDuration = 300 && change if needed - smaller is faster.

DO CASE
CASE tcDirection = "TOP"
JnAT = 1
CASE tcDirection = "NEXT"
JnAT = 8 && or 10
CASE tcDirection = "END"
JnAT = 2
CASE tcDirection = "PREV"
JnAT = 4 && or 5
OTHERWISE
JnAT = 16
ENDCASE

Define Window PaperPage At 1,1 Size 2,2 Name myForm
With myForm
.Height = tnHeight
.Left = tnLeft
.Top = tnTop
.Width = tnWidth
.caption = "ani"
.titlebar = 0
Endwith

Declare Integer AnimateWindow In WIN32API ;
Integer HWnd, Integer dwTime, Integer dwFlags
**************************VFP6/VFP7 option
** If you are using VFP6.. then...
* Set Library To home()+"FoxTools.Fll" Additive
* jnHwnd = _WhToHwnd( _WFindTitl("ani"))
*
** If you are using VFP7.. the code is default..
jnHwnd = myForm.HWnd
**************************
= AnimateWindow(jnHwnd, nDuration, Jnat)
myForm.Show()
myForm.Release()
myForm = .F.
******************************************************
** EOF
******************************************************
** Note: If you are using VFP6,
** suitably change the above code.
******************************************************

Step 2. In the wizard created form, highlight the ButtonSet1.. i.e. the navigation bar provided by the wizard, then.. in its NAVIGATE method, add the following code..(you can again cut and paste the following).

******************************************************
LPARAMETER cDirection
=AniPrg(cDirection, ThisForm.Height-106,ThisForm.Left, ;
ThisForm.Top+72,ThisForm.Width)
DODEFAULT(cDirection)
******************************************************

Note 1. I have not tested under VFP6, but some user can confirm the accuracy for the benefit of others. :)
Note 2. It is quite easy to do the animation similarly for the entire form, and if users like it, I will post that also in another thread.

And that is it. Have a nice day. :)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
By mistake I posted this as a question. Please treat this as helpful Tips. :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Ramani

Clever use. You could also use it as a global class and put on all the projects forms. Or create an animated form baseclass and create every form in your project with ath form baseclass. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hello,

Allow me to bring this thread back to life.

AnimateWindow() does seem a great way to animate the forms. But I've got a couple of questions in my experiment:

1. As the form rolls out smoothly, the form controls don't. The controls are only loaded (visible) when the form is fully rolled out. This may look fine on fast speed but on slow it's awkward.

2. When I try to roll the form back (as in hiding it with animation) using AW_HIDE, I get a black background on the form as the form is hiding in animation.

Are there ways to solve the above?

Thanks,

Ed
 
Hi Ed

As for question 1..

You can play with the values.. may be..
******************************************************
LPARAMETER cDirection
=AniPrg(cDirection, ThisForm.Height+30,ThisForm.Left, ;
ThisForm.Top,ThisForm.Width+6)
DODEFAULT(cDirection)
******************************************************

Question2... I have no comment, since I cannot immediately test.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Hi ramani,

Thanks for your reply. Hmm that doesn't seem to work. When I step through it, the form is actually rolled out as AnimateWindow() is executed. and then the Form.Show() will load the controls. I guess it's probably an internal thing.

Rolling the form back is just as easy as rolling it out, except that instead of using jnAt as 1..16, add 65536 to that, so it's 65537, 65538, etc. And then instead of calling .Show(), call .Hide().

Cheers,

Ed
 
Interesting thread. Is there an equivalent API that one could use for smoothly scrolling (expanding) a container into place?

I'm thinking of how XP has collapsable containers (don't know the proper name for this interface) in many parts of interface.

Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top