Jump to content
Sign in to follow this  

GUICtrlSetOnHover proplem

Recommended Posts


i use GUICtrlSetOnHover udf

but the button in Tab Item and when i moved on the button or click it fast

the button is flashing

how i can stop this flash

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#include "UDFs\Icons.au3"
#include "UDFs\GUICtrlSetOnHover.au3"

Global $Hold = False
Global $Tab1_Background, $Tab1_Button1, $Tab1_Button2, $Tab1_Button3, $tab1

$GUI = GUICreate("Form1", 800, 600, -1, -1)
GUICtrlCreatePic(@ScriptDir & "\images\background_1.bmp", 0, 0, 800, 600, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)

$MainTab = GUICtrlCreateTab(10, 200, 780, 390, $TCS_MULTILINE)
GUICtrlSetState(-1, $GUI_ONTOP)
GUISetFont(14, 700)

$tab1 = GUICtrlCreateTabItem("tab1")
$Tab1_Background = GUICtrlCreatePic(@ScriptDir & "\images\background_1.bmp", 10, 220, 780, 370)
GUICtrlSetState(-1, $GUI_DISABLE)
$Tab1_Button1 = GUICtrlCreatePic("", 380, 280, 90, 22)
GUICtrlSetOnHover(-1, '_HoverButton', '_LeaveButton', '_DownButton', '_HoverButton')
GUICtrlCreateTabItem("") ; end tabitem definition

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE


Func _DownButton($CtrlID)
    If $Hold Then
        $Hold = True
    Local $File

    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_down.png' & $File, $Tab1_Background)
EndFunc   ;==>_DownButton
Func _LeaveButton($CtrlID)
    Local $File
    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_over.png' & $File, $Tab1_Background)
    $Hold = False
EndFunc   ;==>_LeaveButton
Func _HoverButton($CtrlID)
    Local $File
    _SetImage($CtrlID, @ScriptDir & '\Images\Button1_normal.png' & $File, $Tab1_Background)
    $Hold = False
EndFunc   ;==>_HoverButton

all files i used here

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.