Sign in to follow this  
Followers 0
AcidCorps

Change image back after hover

3 posts in this topic

This script is pretty long at this point (a lot of directory reading and web reading) so I'm only going to include the part that I need help on

While 1
    $Msg = GUIGetMsg()
    $Hover = _ControlHover(0)
    If $Hover = 1 Then
        Prewview(@Extended)
    EndIf
    If $Hover = 0 Then GuiCtrlSetImage($GuiBackground, $GuiWallpaper)
    Select
        Case $Msg = $Exit
            Exit
    EndSelect
WEnd

Func Prewview($xControl)
    $Text = GuiCtrlRead($xControl)
    For $i = 1 to $GuiMenuItems[0][0]
        If $Text = $GuiMenuItems[$i][0] Then
            $Element = $i
            ExitLoop
        EndIf
    Next
    $PreviewPic = @ScriptDir & '\' & IniRead($GuiMenuDir & $GuiMenuItems[$Element][1], 'Data', 'ImagePreview', 'bin\menuitems\images\movies.jpg')
    GuiCtrlSetImage($GuiBackground, $PreviewPic)
EndFunc EndFunc

my problem is I can get the iamge to change when the button is hovered over but when I try to add

If $Hover <> 1 Then GuiCtrlSetImage($GuiBackground, $GuiWallpaper)

it flickers the image I want to have when its hovered and then just flickers the background image a lot

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe you should try to set the image once instead of 100 times a second? ;)

$globalflag = 0
While 1
    $Msg = GUIGetMsg()
    $Hover = _ControlHover(0)
    If $globalflag = 0 And $Hover = 1 Then
        $globalflag = 1
        Prewview(@Extended)
    EndIf
    If $globalflag = 1 And $Hover = 0 Then
        $globalflag = 0
        GuiCtrlSetImage($GuiBackground, $GuiWallpaper)
    EndIf
    Select
        Case $Msg = $Exit
            Exit
    EndSelect
WEnd

Edit:Wait... That's not right. Better now?

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Thank you

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