Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Interface Design _ ACC2000: Translucent Forms

Posted by: Dom DXecutioner Jan 18 2007, 01:25 PM

Greetings,
ttached is a sample on how to use transparency on Access forms. The sample contains three functions and it's important to note that the PopUp property of the form must be set to YES or this will NOT work...
SetTranslucent(hWnd As Long, Opacity As Integer)
UIProcessFadeIn(UIForm As Form, Optional EndOpacity As Integer = 255)
UIProcessFadeOut(UIForm As Form, Optional StartOpacity As Integer = 255)
HAs usual, exersice extreme caution when using API's... Some error trapping may be necessary, but not required.
Have fun.
Xy

 ACC2000.TranslucentForms.zip ( 44.92K ): 777
 

Posted by: doctor9 Jan 18 2007, 02:25 PM

Wow, that's sexy.
If I combine this with Shaped Forms (found at http://www.mvps.org/access/forms/frm0053.htm, I should be able to come up with a spooky looking April Fool's prank...
Mwahahaha!!
Dennis

Posted by: Dom DXecutioner Jan 18 2007, 03:02 PM

You could also use http://www.utteraccess.com/forums/showflat.php?Cat=&Board=48&Number=586440&page=6&view=collapsed&sb=5&o=&fpart=1

Posted by: cheekybuddha Jan 18 2007, 03:16 PM

Nice to see you after a long while Xy. -o!
hrisO posted something similar to the http://www.utteraccess.com/forums/showflat.php?Cat=&Board=48&Number=1270845&Zf=f48&Zw=&Zg=0&Zl=a&Main=1270845&Search=true&where=&Zu=20036&Zd=i&Zn=&Zt=7&Zs=b&Zy=#Post1270845&Zp= a short while back.
I had fun passing the Access.HwndApp to the function and making the application window but it had some bad side effects (the database window would flicker when moved after restoring the application window).
Have you worked out a way to apply this to subforms? It would be good to get a subform's hwnd and apply it, but how to deal with the popup requirement?
Regards,
d

Posted by: BlueTick Jan 18 2007, 03:27 PM

Welcome back Xy, your skills were truly missed.
l'Blue

Posted by: CyberCow Jan 18 2007, 03:28 PM

What I like about your demo Xy is that it has an extremely small code footprint. Plus, it converted to A97 with NO problems at all.
Is there a way to set the fade in/out time?
Cool dood!

Posted by: Dom DXecutioner Jan 18 2007, 03:28 PM

Hello and thank you,
My apologies for the thread, i did not realize this code had already been posted.
HAs for the subform... i assume you mean making the subform transparent and the parent form normal. I'm not sure that could be accomplished, but i'd imagined using some subclassing techniques along with other API's would probably be required. If at all possible.
However, because access forms are created dynamically and act different than VB forms, the results would be unpleasant, not to mention the amount of code needed to subclass the subform.
I see very little benefit using this technique and would not recommend it.

Posted by: CyberCow Jan 18 2007, 03:31 PM

Dennis,
I was thinking of placing modified versions of this in our main app and have it trigger different ways depending on who logs in. Not spooky, but could be extremely funny . . .

Posted by: Dom DXecutioner Jan 18 2007, 03:32 PM

Cyber,
Can you elaborate on what you mean by "Is there a way to set the fade in/out time?" Do you mean the speed?

Posted by: CyberCow Jan 18 2007, 03:36 PM

Xy, yeah, the speed at which a fade occurs.

Posted by: Dom DXecutioner Jan 18 2007, 03:45 PM

Cyber,

You could modified the code as follows...

CODE
[color="green"]'// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// PURPOSE:    process fade in effect on any particular form. the form's
'//             POPUP property must be set to YES or this will not work
'// PARAMETERS: [in] UIForm - the form we want to fade in
'//             [in] EndOpacity - the final opacity value in which the form
'//                               is to bet set, if none applied, ignore
'//             [in] FadeSpeed - the value at which the fade speed should occur,
'//                              the higher the value, the faster the fade
'// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[/color]
Public Sub UIProcessFadeIn( _
           UIForm As Form, _
           Optional EndOpacity As Integer = 255, _
           Optional FadeSpeed As Integer = 5)
[color="green"]'// loop counter[/color]
Dim i As Integer
    For i = 1 To EndOpacity Step FadeSpeed
        Call SetTranslucent(UIForm.hWnd, i)
        [color="green"]'// this is required for proper fade effect
        '// otherwise you'll just jump to the transparency immediately
        
        '// you may want to use another method to wait[/color]
        DoEvents
    Next i
End Sub

Posted by: CyberCow Jan 18 2007, 04:12 PM

Thanks Xy ! ! ! !
imagine I can use a similar mod to control fadeout ? ? ? ?

Posted by: Dom DXecutioner Jan 18 2007, 05:17 PM

You're welcome,

and yes, the same concept can be applied to the fade out... one thing to point out, the current effect is also based on the DoEvents call.

if you have a relatively slow system and it has lots of other processes, you'll get different fade speed... you could add sort of a timer function to have more control over the fading speed.

maybe another loop withing the loop may be in order,and kill the DoEvents call.

Posted by: khaos Jan 19 2007, 10:23 AM

I have posted code here before for transparent subs. It's ugly and really doesn't work very good. Messes with other controls on the sub and really didn't do what I wanted.
I use transparent forms though as pop-ups and I have no idea if the users use it yet but it was fun to make. 1 control to allow users to fade in and out (on the main form) and have every pop-up change accordingly.
Ken

Posted by: cheekybuddha Jan 19 2007, 01:39 PM

Hmmm...
suppose I wasn't really thinking of transparent/translucent subforms, but using the fade effect to change subforms/SourceObjects.
d

Posted by: perrymans Jan 19 2007, 04:13 PM

Xy,
o you have a website that showcases all of your work?
Thanks. Sean.

Posted by: Dom DXecutioner Jan 19 2007, 10:55 PM

Perrymans,
do not yet have a website but i'm sure within 6 months or so, i should be able to put it back up...

Posted by: r_cubed Jan 20 2007, 03:34 AM

Moo, there is an example in the Arcives forum posted by ChrtisO. I have mod he od hee o alkso allow it to happen with the acual Access window itself (fade in/out).
ound it easier to control user functionality and not have to worry about hiding/creating menus etc .... if they can't see the window, they can't get to those !!!
Pretty happy with it too ....i

Posted by: CyberCow Jan 20 2007, 07:39 AM

Rob, Thanks! Can you post the link please? (Just to be sure I've found the right one) And would you share your mod . . . that sounds interesting!
Hope all is well down under sad.gif

Posted by: r_cubed Jan 20 2007, 03:59 PM

Moo,
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=83&Number=1274406&Zf=&Zw=chris&Zg=0&Zl=a&Main=1274252&Search=true&where=&Zu=15840&Zd=l&Zn=&Zt=1f&Zs=b&Zy=#Post1274406&Zp= is the link to a thread in which I then ALSO 'point' to Chros_O's archived demo.
Inthe thread I have pointed you too above, I also included the code that I am using to 'fade in/out' the application window, PLUS (as Xynox) has stated originally .... all forms have to be Pop-Ups .... I have the code to enable you to BULK update all forms in an existing application to achieve this requirement in about 2 seconds.
All is well down under ..... still travelling for my contract (originally a 4 week/1 application contract which has now become a 9 month/ 4th application contract, and looks like continuing).
Long days (5.30am - 7.30pm) with the travel (train), but GREAT bunch of people to work with (the best I have encountered) and the money is too good.
Hope you get some benefit from the combined links above.
Catch ya in the ether .....

Posted by: CyberCow Jan 20 2007, 07:19 PM

Thanks Rob! I will definitely be a-playin' with this one.
Glad to hear your contracts are getting extended. And it's always grand when both the money and co-workers are good. Kinda makes up for the long hours. See ya!

Posted by: cheekybuddha Jan 21 2007, 01:44 PM

Hi Rob and Mark,
Is I mentioned above, fading the application window out and in has a curious side effect on the database window. It will flicker a lot when moved (once the app window has been faded back in). Hence Chris removed that particular code from his final example.
You can find the original thread in the VIP forum.
Regards,
d

Posted by: njonsie Jan 23 2007, 09:54 AM

Very nice!

Posted by: Centity Feb 1 2007, 11:34 AM

shocked.gif Stunning... absolutely stunning shocked.gif

Posted by: perrymans Feb 4 2007, 09:40 PM

I don't see the value in this, and it doesn't look that doos anyway...
Sike!
This is HOTT!
Good to have your back X!
Sean.

Posted by: Dom DXecutioner Feb 6 2007, 03:00 PM

LOL, thank you...

Posted by: bekibutton Mar 14 2007, 07:01 AM

Xy,
If the system is struggling with the code as it is on the DoEvents call, will looping ease the pressure a bit and get the fade speed back to normal?

The db I'm using this in (posted http://www.utteraccess.com/forums/uaremgo.php?Cat=&F_Board=83&Thread=1371856&Main=1370412) seems to get 'bored' after a while. Initial fade speeds are great but then it really starts to lag and the fade takes a lot longer. I'm wondering if changing the method will help at all....?

B
Edited by: bekibutton on Wed Mar 14 8:07:27 EDT 2007.

Posted by: Dom DXecutioner May 8 2007, 09:39 PM

hi becki...

better late than never... sad.gif

theoretically, it should... by using the DoEvents function, you're allowing the system to process other requests, this could range from microsoft update, anti-virus, other applications calls. if you omit the DoEvents, Access will hog all the CPU time just for the fading process until completed... i think sad.gif


Edited by: Xyon-X on Tue May 8 22:40:25 EDT 2007.