KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Fade

 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
It Took My Prozac
KiXforms Supporter
KiXforms Supporter


Joined: 15 Feb 2005
Posts: 65

PostPosted: Tue Aug 21, 2007 12:08 am    Post subject: Fade Reply with quote

Hi All,
I like to use this Fade function to add a bit of eye candy to my KiXforms apps. I hope you like it.
Cheers,
Richard


Code:
Function Fade($Form,Optional $Opacity, $MSecs, $NoDispose)

;AUTHOR         Richard von Mallesch (It Took My Prozac)
;ACTION         Used for fading in and out windows
;SYNTAX         Fade($Form[,Optional $Opacity, $MSecs, $NoDispose)
;PARAMETERS      Form
;               Window Form to be faded
;               Opacity
;               Optional Opacity. Default is 0
;               MSecs
;               Optional Time to Fade Over. Default is 400
;               NoDispose
;               Optional boolean to stop item being disposed if opacity is 0.
;DEPENDENCIES   none
;EXAMPLE         Fade($frmLogo,90)

   $Opacity=IIf($Opacity,$Opacity,0)
   $MSecs=IIf($MSecs,$MSecs,400)
   If $Form.visible=0
      $Form.Opacity=0
      $Form.Show
   EndIf
   Dim $Ticks,$Init,$Diff
   $Init=CDbl($Form.Opacity)
   If $Init<>$Opacity
      $Ticks=@TICKS
      $Diff=@TICKS-$Ticks
      Do $Form.Opacity=$Init+CDbl($Opacity-$Init)*$Diff/$msecs
         $Diff=@TICKS-$Ticks
      Until $Diff>=$msecs
      $Form.Opacity=$Opacity
   EndIf
   If $Opacity=0
      If $NoDispose
         $Form.Hide
      Else
         $Form.Dispose
      EndIf
   EndIf

EndFunction
Back to top
View user's profile Send private message
It Took My Prozac
KiXforms Supporter
KiXforms Supporter


Joined: 15 Feb 2005
Posts: 65

PostPosted: Tue Aug 21, 2007 3:53 am    Post subject: Reply with quote

By the way, to fade out when someone closes a form, set the OnClosing event to:
Code:
$Form.OnClosing = "Fade($$Form)"
Back to top
View user's profile Send private message
OwenJ
KiXforms Follower
KiXforms Follower


Joined: 14 Jan 2007
Posts: 19
Location: Alton, Hampshire, England (UK)

PostPosted: Thu Dec 06, 2007 2:46 pm    Post subject: Reply with quote

That is a really nice piece of script. This has added a nice lil' touch to mine.

However I am stumped on the ability on fading into a form.

Also can this be done to other fields instead of just a form? EG a lable, or a text box?

_________________
Owen Johnson. aka |SirianKnight| Shocked
Back to top
View user's profile Send private message Send e-mail MSN Messenger
It Took My Prozac
KiXforms Supporter
KiXforms Supporter


Joined: 15 Feb 2005
Posts: 65

PostPosted: Thu Dec 06, 2007 10:58 pm    Post subject: Reply with quote

To fade in a form, just use...
Code:
Fade($Form,100)

This function could also be modified to fade other objects if they had an opacity property. To my knowledge however, only the form object supports this property.
Back to top
View user's profile Send private message
OwenJ
KiXforms Follower
KiXforms Follower


Joined: 14 Jan 2007
Posts: 19
Location: Alton, Hampshire, England (UK)

PostPosted: Mon Dec 10, 2007 6:38 pm    Post subject: Reply with quote

OK I have got the lil' badger working now.

I used "$Form.Fade = Fade($Form,100)" in the form section.

This is a great UDF which you have created. well done! Very Happy

_________________
Owen Johnson. aka |SirianKnight| Shocked
Back to top
View user's profile Send private message Send e-mail MSN Messenger
It Took My Prozac
KiXforms Supporter
KiXforms Supporter


Joined: 15 Feb 2005
Posts: 65

PostPosted: Mon Dec 10, 2007 10:14 pm    Post subject: Reply with quote

Thanks. However, you just need to use Fade($Form,100) not $Form.Fade = Fade($Form,100) as Fade is not a property of the Form object.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group