Sign in to follow this  
Followers 0
jftuga

Need help with WinSetTrans() transparency

4 posts in this topic

My program is almost finished and I am just about ready to post it to "v3 Scripts and Scraps" as soon as I get this one really nagging bug fixed. I am using transparency and am trying to fade my application in & out depending on its focus.

If you look in the OnAdLib() function on line 169, you will notice that FadeOut() and the two FadeIn()'s are commented out because they do not work. Under each of them I have simply changed the transparency, which does work albeit not as pretty. If I comment those lines out and try using the FadeIn() and FadeOut() functions, nothing seems to happen. What am I doing wrong?

Since the code is over 300 lines long, I will attach the full source as a zip and only paste in the relative portion of the script.

Any help would be greatly appreciated. I am using Windows XP SP2 and the latest AutoIt beta.

Thanks,

-John

Func FadeOut()
;MsgBox(0,"FadeOut","Active:"&$Active & "  High:"&$High_Trans & "  Default:"&$Default_Trans)
    for $i = $High_Trans to $Default_Trans step - 10
        WinSetTrans($TopWin, "", $i)
        sleep(10)
    next
endfunc
    
Func FadeIn()
;MsgBox(0,"FadeIn","Active:"&$Active & "  Default:"&$Default_Trans & "  High:"&$High_Trans )
    for $i = $Default_Trans to $High_Trans step + 10
        WinSetTrans($TopWin, "", $i)
        sleep(10)
    next
endfunc
    
Func OnAdLib()
;MsgBox(0,"AdLib", "Active:"&$Active)
    Dim $pos

; going out of focus
    If $Active = 1 And Not WinActive($TopWin) Then
        $pos = MouseGetPos()
        if $pos[0] > $BoundingBox_A AND $pos[0] < $BoundingBox_X AND _
                        $pos[1] > $BoundingBox_B AND $pos[1] < $BoundingBox_Y Then
            return
        endif

    ;FadeOut()
        WinSetTrans($TopWin, "", $Default_Trans)
        $Active = 0

; coming in to focus
    ElseIf $Active = 0 Then
        $pos = MouseGetPos()
        if $pos[0] > $BoundingBox_A AND $pos[0] < $BoundingBox_X AND _
                        $pos[1] > $BoundingBox_B AND $pos[1] < $BoundingBox_Y Then
        ;FadeIn()
            WinSetTrans($TopWin, "", $High_Trans)
            $Active = 1
            return
        endif

        If WinActive($TopWin) Then
        ;FadeIn()
            WinSetTrans($TopWin, "", $High_Trans)
            $Active = 1
        EndIf
    EndIf
EndFunc

remote_manager_v6.zip

Share this post


Link to post
Share on other sites



Larry,

Wow, AnimateWindow is really cool! However, I think there is a bug in my code. In previous versions fading worked. But I refactored the code and cleaned it up a bit. Afterwards, it didn't work. :-(

I wish I could get it working without having to use AnimateWindow, but if there is no other choice then I will use it.

-John

Share this post


Link to post
Share on other sites

Func FadeOut()
;MsgBox(0,"FadeOut","Active:"&$Active & "  High:"&$High_Trans & "  Default:"&$Default_Trans)
    for $i = Int($High_Trans) to Int($Default_Trans) step - 10
        WinSetTrans($TopWin, "", $i)
        sleep(10)
    next
endfunc
    
Func FadeIn()
;MsgBox(0,"FadeIn","Active:"&$Active & "  Default:"&$Default_Trans & "  High:"&$High_Trans )
    for $i = Int($Default_Trans) to Int($High_Trans) step + 10
        WinSetTrans($TopWin, "", $i)
        sleep(10)
    next
endfunc
    
Func OnAdLib()
;MsgBox(0,"AdLib", "Active:"&$Active)
    Dim $pos

; going out of focus
    If $Active = 1 And Not WinActive($TopWin) Then
        $pos = MouseGetPos()
        if $pos[0] > $BoundingBox_A AND $pos[0] < $BoundingBox_X AND _
                        $pos[1] > $BoundingBox_B AND $pos[1] < $BoundingBox_Y Then
            return
        endif

    FadeOut()
   ;    WinSetTrans($TopWin, "", $Default_Trans)
        $Active = 0

; coming in to focus
    ElseIf $Active = 0 Then
        $pos = MouseGetPos()
        if $pos[0] > $BoundingBox_A AND $pos[0] < $BoundingBox_X AND _
                        $pos[1] > $BoundingBox_B AND $pos[1] < $BoundingBox_Y Then
        FadeIn()
       ;    WinSetTrans($TopWin, "", $High_Trans)
            $Active = 1
            return
        endif

        If WinActive($TopWin) Then
        FadeIn()
       ;    WinSetTrans($TopWin, "", $High_Trans)
            $Active = 1
        EndIf
    EndIf
EndFunc

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0