topten Posted July 30, 2015 Share Posted July 30, 2015 I think I should have posted this question here (related to this udf) Link to comment Share on other sites More sharing options...
Leo1906 Posted October 26, 2016 Share Posted October 26, 2016 This UDf unfortunately is not compatible with touch clicks .. So for example if you register the PrimaryUpFunc it works fine for Mouse-Clicks but not if you "click" with your finger .. I tried to solve this by using the WM_TOUCH message but this message unfortunately won't get executed when touching on a control .. Is there any way to solve this problem? Link to comment Share on other sites More sharing options...
siva1612 Posted March 24, 2017 Share Posted March 24, 2017 (edited) The problem is the below code freezes whenever I click the close button #include <GUICtrlOnHover.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) $MainScreen = GUICreate("", 300, 300, -1, -1, $WS_POPUP) $TopBarLbl = GUICtrlCreateLabel("", 0, 0, 280, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0x000000) $MainScreenClose = GUICtrlCreateLabel("X", 280, 0, 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetOnEvent(-1, "ExitAll") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) _GUICtrl_OnHoverRegister($MainScreenClose, "SpecialHoverOnLabel", "SpecialHoverOnLabel") GUISetState() While 1 Sleep(50) WEnd Func ExitAll() Exit EndFunc ;==>ExitAll Func SpecialHoverOnLabel($iCtrlID, $iParam) GUICtrlSetBkColor($iCtrlID, ($iParam = 1) ? 0x2DA84C : 0x000000) EndFunc ;==>SpecialHoverOnLabel Figured it out. The click event has to be specified in the Register func itself #include <GUICtrlOnHover.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) $MainScreen = GUICreate("", 300, 300, -1, -1, $WS_POPUP) $TopBarLbl = GUICtrlCreateLabel("", 0, 0, 280, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0x000000) $MainScreenClose = GUICtrlCreateLabel("X", 280, 0, 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) ;GUICtrlSetOnEvent(-1, "ExitAll") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) _GUICtrl_OnHoverRegister($MainScreenClose, "SpecialHoverOnLabel", "SpecialHoverOnLabel", "ExitAll") GUISetState() While 1 Sleep(50) WEnd Func ExitAll() Exit EndFunc ;==>ExitAll Func SpecialHoverOnLabel($iCtrlID, $iParam) GUICtrlSetBkColor($iCtrlID, ($iParam = 1) ? 0x2DA84C : 0x000000) EndFunc ;==>SpecialHoverOnLabel Edited March 30, 2017 by siva1612 Posted the problem and soltion Link to comment Share on other sites More sharing options...
spudw2k Posted March 29, 2017 Share Posted March 29, 2017 (edited) On 3/23/2017 at 9:10 PM, siva1612 said: Figured it out. Please delete this post. Firstly; typically the MODs don't get in the business of deleting posts. Secondly; even if you solved it yourself, it may be useful for future readers to read the problem & your solution. edit: user added problem and solution to his post Edited April 13, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
borsTiHD Posted March 6, 2019 Share Posted March 6, 2019 (edited) Hi all, I know this UDF and the thread is older, but I'm using this UDF for so long now and it is the perfect way. Mainly I use the UDF for hover effects on buttons, or labels, but here and there also for click events. For a long time I have had the problem that smaller ChildGUIs, or PopUps that are only short to see (about 1-3 seconds screentime), sometimes do not display any controls. The whole thing is very irregular, but occurs with me about in 3 of 5 cases. Unfortunately my project is much too big, so I created a small demo where I can reproduce the problem on my site. Unfortunately the problem occurs much less often in the demo than in my main project. But when it occurs you can only see the background of the GUI, but no labels. By the way, it only seems to occur if I have registered at least one control with "_GUICtrl_OnHoverRegister()". If I have not registered a control, but included the UDF anyway, the error does not occur. Can someone please look at this problem? Or does anyone have any idea how I could work around this problem? I don't want to do without the UDF. Many thanks in advance. borsTiHD expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> #include <Misc.au3> #include 'includes\GUICtrl_SetOnHover\GUICtrlOnHover.au3' ; https://www.autoitscript.com/forum/topic/55120-guictrlsetonhover-udf/ ;GUI Options Opt("GUIOnEventMode", 1) ;OnEvent Mode wird aktiviert Opt("GUIEventOptions", 1) ;Ignoriert Windows Funktionen zum Minimieren und Schließen Opt("GUIResizeMode", 802) ;Sorgt dafür das die einzelnen GUI Elemente sich nicht in der Größe verändern Opt("GUICoordMode", 1) ;Benutzt feste Koordinaten für Elemente Global $Hotkey = "^y" HotKeySet($Hotkey, "SomeFunc") Local $hGUI = GUICreate("Test", 800, 500) Local $hLabel = GUICtrlCreateLabel("Test Label", 20, 15, 145, 30) _GUICtrl_OnHoverRegister($hLabel, "_BTN_Hover_Func", "_BTN_Hover_Func", "_BTN_PrimaryDown_Func", "_BTN_PrimaryUp_Func") GUISetState() While 1 Sleep(100) WEnd Func SomeFunc() send("^c") sleep(200) Local $sString = ClipGet() PopUp($sString) EndFunc Func PopUp($sString, $iFade = 200) Local Static $GUIFade = 0 ConsoleWrite("$sString: " & $sString & @CRLF) ;Löscht GUI, sollte diese bereits existieren If WinExists($GUIFade) Then GUISwitch($GUIFade) GUIDelete($GUIFade) EndIf Local $MousePos = MouseGetPos() ;GUI $GUIFade = GUICreate("", 200, 40, $MousePos[0], $MousePos[1], $WS_POPUP) GUISetBkColor($COLOR_WHITE) GUICtrlCreateLabel($sString, 20, 15, 145, 30, 0x01) GUICtrlSetFont(-1, 10, -1, -1, "Arial Fett") GUISetState(@SW_SHOWNOACTIVATE, $GUIFade) WinSetOnTop($GUIFade, "", 1) Sleep($iFade) For $i = 1 To 18 WinSetTrans($GUIFade, "", 255 - ($i * 10)) WinSetOnTop($GUIFade, "", 1) Sleep(30) Next GUIDelete($GUIFade) GUISwitch($hGUI) EndFunc ;==>PopUp ; Button Hover/Leave Func _BTN_Hover_Func($iCtrlID, $iParam) ; >> GUICtrlOnHover UDF ConsoleWrite("_BTN_Hover_Func() - Test " & @CRLF) Return True EndFunc ;==>_BTN_Hover_Func ; Button Mouseclick Func _BTN_PrimaryDown_Func($iCtrlID) ; >> GUICtrlOnHover UDF ConsoleWrite("_BTN_PrimaryDown_Func() - Test " & @CRLF) Return True EndFunc ;==>_BTN_Hover_Func ; Button Mouseclick release Func _BTN_PrimaryUp_Func($iCtrlID) ; >> GUICtrlOnHover UDF ConsoleWrite("_BTN_PrimaryUp_Func() - Test " & @CRLF) Return True EndFunc ;==>_BTN_Hover_Func Edit: Ok... I looked at that again. With the GUICtrlOnHover_NoCallback.au3 the behavior does not happen. In the past, I had the problems by changing between OnEvent and MsgLoop Mode. I bypassed this by only using the OnEvent mode, but this also causes me problems with for example _ArrayDisplay(). That's why I avoid switching between the two modes. But still I get, although I stay in one mode (OnEvent), the problems described above. Edited March 7, 2019 by borsTiHD Link to comment Share on other sites More sharing options...
ibecko Posted November 13, 2022 Share Posted November 13, 2022 (edited) $WS_EX_NOACTIVATE + @SW_SHOWNOACTIVATE not work, cant click n run function expandcollapse popup#include 'GUICtrlOnHover_NoCallback.au3' #include <GUIConstants.au3> #include 'misc.au3' Opt('GUIOnEventMode', 1) Opt('GUICoordMode', 2) $Menu = GUICreate('Menu', 398, 88, -1, 200, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $WS_EX_NOACTIVATE) ; $WS_EX_NOACTIVATE not work with @SW_SHOWNOACTIVATE $idBackgroundLabel0 = GUICtrlCreateLabel('', 0, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel0, $GUI_BKCOLOR_TRANSPARENT) _GUICtrl_OnHoverRegister($idBackgroundLabel0, 'FnHover', 'FnNormal', 'FnActive') $idLbl0 = GUICtrlCreateLabel(' Label 0', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl0, $GUI_BKCOLOR_TRANSPARENT) $idBackgroundLabel1 = GUICtrlCreateLabel('', -1, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel1, $GUI_BKCOLOR_TRANSPARENT) _GUICtrl_OnHoverRegister($idBackgroundLabel1, 'FnHover', 'FnNormal', 'FnActive') $idLbl1 = GUICtrlCreateLabel(' Label 1', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl1, $GUI_BKCOLOR_TRANSPARENT) $idBackgroundLabel2 = GUICtrlCreateLabel('', -1, 0, 400, 30) GUICtrlSetBkColor($idBackgroundLabel2, $GUI_BKCOLOR_TRANSPARENT) _GUICtrl_OnHoverRegister($idBackgroundLabel2, 'FnHover', 'FnNormal', 'FnExit') $idLbl2 = GUICtrlCreateLabel(' Exit Program', -1, -1, 400, 30, $SS_CENTERIMAGE) GUICtrlSetBkColor($idLbl2, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOWNOACTIVATE, $Menu) ; @SW_SHOWNOACTIVATE not work with $WS_EX_NOACTIVATE for $i = 0 to 0 step 0 if WinGetProcess(WinGetHandle('')) = @AutoItPID and _IsPressed('1B') then exit Sleep(10) next Func FnNormal($idCtrl, $hWnd, $vData) GUICtrlSetBkColor($idCtrl, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor($idCtrl+1, 0x000000) ConsoleWrite(@CRLF & 'Leave ' & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) GUICtrlSetBkColor($idCtrl, 0x000000) GUICtrlSetColor($idCtrl+1, 0xFFFFFF) ConsoleWrite(@CRLF & 'Hover ' & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & 'Active ' & $idCtrl) EndFunc Func FnExit($idCtrl, $hWnd, $vData) exit EndFunc Edited November 14, 2022 by ibecko Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now