Sign in to follow this  
Followers 0
monter

Problem with flickering +WinSetTrans

3 posts in this topic

I'd like to have a Always-On-Top semi-transparent GUI window. When I move the cursor over it - it should be solid. But it is ugly flickering effect. Below the code:

#include <GUIConstants.au3>
Const $guiW = 400
Const $guiH = 200
$guiTitle = "Transparency & cursor hovering"
$myGUI = GUICreate($guiTitle, $guiW, $guiH)
$label = GUICtrlCreateLabel("How to avoid flickering when mouse is over the GUI?", 80, 20, 300, 17)
If @OSTYPE = "WIN32_WINDOWS" Then $xponly = GUICtrlCreateLabel("This works only in Win XP/2000.", 120, 40, 200, 17)
$combo = GUICtrlCreateCombo("but not set too long delay", 125, 60, 150, 100)
$comboItem = GUICtrlSetData(-1, "in Adlib function")
$edit = GUICtrlCreateEdit("I don't know. Anyone help?", 100, 100, 200, 50, $ES_READONLY)
$button = GUICtrlCreateButton("E&xit", 175, 160, 50, 25)

GUISetState(@SW_SHOW)
WinSetOnTop($guiTitle, "", 1)
AdlibEnable("HoverTrans")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit()
        Case $button
            _Exit()
    EndSwitch
WEnd

Func HoverTrans()
    $hover = GUIGetCursorInfo()
    Select
        Case $hover[0] < 0 Or $hover[1] < 0 Or $hover[0] > $guiW Or $hover[1] > $guiH
            WinSetTrans($guiTitle, "", 160)
        Case Else
            WinSetTrans($guiTitle, "", 255)
    EndSelect
    
EndFunc  ;==>HoverTrans

Func _Exit()
    Exit
EndFunc  ;==>_Exit

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
Const $guiW = 400
Const $guiH = 200
$solid = 1
$guiTitle = "Transparency & cursor hovering"
$myGUI = GUICreate($guiTitle, $guiW, $guiH)
$label = GUICtrlCreateLabel("How to avoid flickering when mouse is over the GUI?", 80, 20, 300, 17)
If @OSTYPE = "WIN32_WINDOWS" Then $xponly = GUICtrlCreateLabel("This works only in Win XP/2000.", 120, 40, 200, 17)
$combo = GUICtrlCreateCombo("but not set too long delay", 125, 60, 150, 100)
$comboItem = GUICtrlSetData(-1, "in Adlib function")
$edit = GUICtrlCreateEdit("I don't know. Anyone help?", 100, 100, 200, 50, $ES_READONLY)
$button = GUICtrlCreateButton("E&xit", 175, 160, 50, 25)

GUISetState(@SW_SHOW)
WinSetOnTop($guiTitle, "", 1)
AdlibEnable("HoverTrans")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit()
        Case $button
            _Exit()
    EndSwitch
WEnd

Func HoverTrans()
    $hover = GUIGetCursorInfo()
    Select
        Case $hover[0] < 0 Or $hover[1] < 0 Or $hover[0] > $guiW Or $hover[1] > $guiH
            If $solid Then
                $solid = 0
                WinSetTrans($guiTitle, "", 160)
            EndIf
        Case $solid = 0
            $solid = 1
            WinSetTrans($guiTitle, "", 255)
    EndSelect
    
EndFunc   ;==>HoverTrans

Func _Exit()
    Exit
EndFunc   ;==>_Exit


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

$solid = 1
            If $solid Then
                $solid = 0
                WinSetTrans($guiTitle, "", 160)
            EndIf
        Case $solid = 0
            $solid = 1
Thank You very much! :D

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

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