Jump to content

Help! -- Rollover function


Crash
 Share

Recommended Posts

I copied the scripts somewhere in this forum, and I modified it a bit. But I encountered a problem: every time the first button is rolled over, the second button is kind-off erased. If the second one is roll-overed, the third one is erased again and so on.

How can I fix this problem? And can you make it in such a way that you replace the rollover function to down function. I mean, it will not change when the mouse is over it, but will change when the button is clicked. (and the down button stays there until another is clicked)

Can you help me? :)

**Pst pst!! You will be credited for helping me!! Thanks!! And congrats for finding this!**

RollOver with problems.zip

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

I believe I solve it like this:

#Include <GUICtrlSetOnHover.au3> #Include <GUIConstantsEx.au3> #Include <GDIPlus.au3>    _GDIPlus_Startup()  ;Mine GUICreate("Fungicide 2010", 790, 556) GUISetBkColor(0xFFFFFF) GUISetState()                       ;~ ;Find colour theme ;~ If $antiautorunning = "true" And $firewallrunning = "true" Then ;~    $colourtheme = "green" ;~ Else ;~   $colourtheme = "red" ;~             EndIf  ;GUI bg GUICtrlCreatePic(@ScriptDir&"\main_bg_top.jpg", 0, 0, 790, 78) $Pic1=GUICtrlCreatePic(@ScriptDir&"\main_bg_left.jpg", 0, 78, 245, 443) $hPic1 = GUICtrlGetHandle($Pic1) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreatePic(@ScriptDir&"\main_bg_bottom.jpg", 0, 521, 790, 35)  ;End of Mine  ;Create Overall Menu $Pic2 = GUICtrlCreatePic('', 20, 78, 220, 80) $hPic2 = GUICtrlGetHandle($Pic2) _SetImageHover($Pic2, @ScriptDir & '\menu_overall_up.jpg') GUICtrlSetOnHover($Pic2, 'HoverPic', 'LeaveHoverPic')   ;Create Protection Menu $Pic3 = GUICtrlCreatePic('', 20, 163, 220, 80) $hPic3 = GUICtrlGetHandle($Pic3) _SetImageHover($Pic3, @ScriptDir & '\menu_protection_up.jpg') GUICtrlSetOnHover($Pic3, 'HoverPic', 'LeaveHoverPic')  ;Create Protection Menu $Pic4 = GUICtrlCreatePic('', 20, 248, 220, 80) $hPic4 = GUICtrlGetHandle($Pic4) _SetImageHover($Pic4, @ScriptDir & '\menu_recovery_up.jpg') GUICtrlSetOnHover($Pic4, 'HoverPic', 'LeaveHoverPic')  ;Create Configuration Menu $Pic5 = GUICtrlCreatePic('', 20, 333, 220, 80) $hPic5 = GUICtrlGetHandle($Pic5) _SetImageHover($Pic5, @ScriptDir & '\menu_configuration_up.jpg') GUICtrlSetOnHover($Pic5, 'HoverPic', 'LeaveHoverPic')  ;Create About Menu $Pic6 = GUICtrlCreatePic('', 20, 418, 220, 80) $hPic6 = GUICtrlGetHandle($Pic6) _SetImageHover($Pic6, @ScriptDir & '\menu_about_up.jpg') GUICtrlSetOnHover($Pic6, 'HoverPic', 'LeaveHoverPic')  While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd  Func HoverPic($CtrlID)     Select         Case $CtrlID = $Pic2             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic2))             _SetImageHover($Pic2, @ScriptDir & '\menu_overall_down.jpg')            _WinAPI_InvalidateRect($hPic2)             _WinAPI_InvalidateRect($hPic3)               Case $CtrlID = $Pic3             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic3))             _SetImageHover($Pic3, @ScriptDir & '\menu_protection_down.jpg')            _WinAPI_InvalidateRect($hPic3)             _WinAPI_InvalidateRect($hPic4)                   Case $CtrlID = $Pic4             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic4))             _SetImageHover($Pic4, @ScriptDir & '\menu_recovery_down.jpg')          _WinAPI_InvalidateRect($hPic4)             _WinAPI_InvalidateRect($hPic5)                   Case $CtrlID = $Pic5             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic5))             _SetImageHover($Pic5, @ScriptDir & '\menu_configuration_down.jpg')             _WinAPI_InvalidateRect($hPic5)             _WinAPI_InvalidateRect($hPic6)                   Case $CtrlID = $Pic6             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic6))             _SetImageHover($Pic6, @ScriptDir & '\menu_about_down.jpg')             _WinAPI_InvalidateRect($hPic6)     EndSelect EndFunc   ;==>HoverPic  Func LeaveHoverPic($CtrlID)     Select         Case $CtrlID = $Pic2             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic2))             _SetImageHover($Pic2, @ScriptDir & '\menu_overall_up.jpg')             _WinAPI_InvalidateRect($hPic3)                  Case $CtrlID = $Pic3             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic3))             _SetImageHover($Pic3, @ScriptDir & '\menu_protection_up.jpg')             _WinAPI_InvalidateRect($hPic4)                   Case $CtrlID = $Pic4             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic4))             _SetImageHover($Pic4, @ScriptDir & '\menu_recovery_up.jpg')             _WinAPI_InvalidateRect($hPic5)                     Case $CtrlID = $Pic5             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic5))             _SetImageHover($Pic5, @ScriptDir & '\menu_configuration_up.jpg')           _WinAPI_InvalidateRect($hPic5)             _WinAPI_InvalidateRect($hPic6)                   Case $CtrlID = $Pic6             _WinAPI_InvalidateRect($hPic1, _ControlGetRect($hPic6))             _SetImageHover($Pic6, @ScriptDir & '\menu_about_up.jpg')             _WinAPI_InvalidateRect($hPic6)     EndSelect EndFunc   ;==>LeaveHoverPic  Func _ControlGetRect($hWnd)      Local $Pos = ControlGetPos($hWnd, '', '')     Local $tRect = DllStructCreate('int;int;int;int')      DllStructSetData($tRect, 1, $Pos[0])     DllStructSetData($tRect, 2, $Pos[1])     DllStructSetData($tRect, 3, $Pos[0] + $Pos[2])     DllStructSetData($tRect, 4, $Pos[1] + $Pos[3])     Return $tRect EndFunc   ;==>_ControlGetRect  Func _SetImageHover($ControlID, $sImage)      Local $hWnd = GUICtrlGetHandle($ControlID)     Local $hImage, $hBitmap  ;    _GDIPlus_Startup()     $hImage = _GDIPlus_BitmapCreateFromFile($sImage)     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     _GDIPlus_ImageDispose($hImage) ;    _GDIPlus_Shutdown()     _WinAPI_DeleteObject(_SendMessage($hWnd, 0x0173))     _SendMessage($hWnd, 0x0172, 0, $hBitmap)     $hImage = _SendMessage($hWnd, 0x0173)     If $hImage <> $hBitmap Then         _WinAPI_DeleteObject($hBitmap)     EndIf EndFunc   ;==>_SetImageHover

But how do I make it to click instead of hover?

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

How about editing that to a readable format...

:)

This thread is a mistake I think. It has been duplicated here but with the code which is missing from this thread, and I have given a partial answer.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...