sandin Posted February 3, 2009 Share Posted February 3, 2009 The following script contains several buttons, all with hover function. Tooltip disappears after user move mouse pointer away from buttons, but it doesn't disappears after colored button. Why? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> Global $hGui, $cInput, $wProcOld, $btn, $btn2, $wProcHandle Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_MOUSELEAVE = 0x02A3 $hGui = GUICreate("buttons script", 200, 600, -1, -1) $y_coord = 5 dim $btn[21] for $i = 1 to 20 $btn[$i] = GUICtrlCreateButton("button", 10, $y_coord, 100, 23, $WS_CLIPSIBLINGS) if $i = 5 or $i = 6 or $i = 7 or $i = 10 then GUICtrlSetBkColor(-1, 0x00FF00) $y_coord += 25 Next $y_coord = 30 $wProcHandle = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;wparam;lparam") for $i = 1 to 20 $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE for $i = 1 to 20 _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, $wProcOld) Next DllCallbackFree($wProcHandle) Exit EndSwitch WEnd Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_LBUTTONDOWN ToolTip("") TrayTip("Mouse", "DOWN", 4 ,1) Case $WM_LBUTTONUP ToolTip("") TrayTip("Mouse", "UP", 4 ,1) Case $WM_MOUSELEAVE ToolTip("") TrayTip("", "", 4 ,1) Case $WM_SETCURSOR ToolTip("hover" & @CRLF & "control handle: " & @CRLF & $hWnd) EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Madza91 Posted February 3, 2009 Share Posted February 3, 2009 I think you don't receive $WM_MOUSELEAVE notification for colored buttons... Here is my solution: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> Global $hGui, $cInput, $wProcOld, $btn, $btn2, $wProcHandle Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_MOUSELEAVE = 0x02A3 $hGui = GUICreate("buttons script", 200, 600, -1, -1) $y_coord = 5 dim $btn[21] for $i = 1 to 20 $btn[$i] = GUICtrlCreateButton("button", 10, $y_coord, 100, 23, $WS_CLIPSIBLINGS) if $i = 5 or $i = 6 or $i = 7 or $i = 10 then GUICtrlSetBkColor(-1, 0x00FF00) $y_coord += 25 Next $y_coord = 30 $wProcHandle = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;wparam;lparam") for $i = 1 to 20 $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE for $i = 1 to 20 _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, $wProcOld) Next DllCallbackFree($wProcHandle) Exit EndSwitch WEnd Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_LBUTTONDOWN ToolTip("") TrayTip("Mouse", "DOWN", 4 ,1) Case $WM_LBUTTONUP ToolTip("") TrayTip("Mouse", "UP", 4 ,1) Case $WM_MOUSELEAVE ToolTip("") TrayTip("", "", 4 ,1) Case $WM_SETCURSOR ToolTip("hover" & @CRLF & "control handle: " & @CRLF & $hWnd) Switch $wParam Case GUICtrlGetHandle($btn[5]), GUICtrlGetHandle($btn[6]), GUICtrlGetHandle($btn[7]), GUICtrlGetHandle($btn[10]) AdlibEnable("adlib", 10) EndSwitch Case Else ConsoleWrite($uiMsg & @CRLF) EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc Func Adlib() Local $cmsg = GUIGetCursorInfo() If $cmsg[4] = 0 Then ToolTip("") TrayTip("", "", 4 ,1) EndIf AdlibDisable() EndFunc [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
sandin Posted February 3, 2009 Author Share Posted February 3, 2009 tnx, but it doesn't work always, it works in ~25% cases. In 75% the tooltip remain standing. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
trancexx Posted February 3, 2009 Share Posted February 3, 2009 Yes, it appears that $WM_MOUSELEAVE is not received (properly?). Try like this (it's modification of n3nE's): expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> Global $hGui, $cInput, $wProcOld, $btn, $btn2, $wProcHandle Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_MOUSELEAVE = 0x02A3 $hGui = GUICreate("buttons script", 200, 600, -1, -1) $y_coord = 5 Dim $btn[21] For $i = 1 To 20 $btn[$i] = GUICtrlCreateButton("button", 10, $y_coord, 100, 23, $WS_CLIPSIBLINGS) If $i = 5 Or $i = 6 Or $i = 7 Or $i = 10 Then GUICtrlSetBkColor(-1, 0x00FF00) $y_coord += 25 Next $y_coord = 30 $wProcHandle = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;wparam;lparam") For $i = 1 To 20 $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) Next GUISetState(@SW_SHOW) Global $cmsg While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE For $i = 1 To 20 _WinAPI_SetWindowLong(GUICtrlGetHandle($btn[$i]), $GWL_WNDPROC, $wProcOld) Next DllCallbackFree($wProcHandle) Exit EndSwitch $cmsg = GUIGetCursorInfo($hGui) If Not $cmsg[4] Then ToolTip("") TrayTip("", "", 4 ,1) EndIf WEnd Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_LBUTTONDOWN ToolTip("") TrayTip("Mouse", "DOWN", 4, 1) Case $WM_LBUTTONUP ToolTip("") TrayTip("Mouse", "UP", 4, 1) ;Case $WM_MOUSELEAVE ; ToolTip("") ; TrayTip("", "", 4 ,1) Case $WM_SETCURSOR ToolTip("hover" & @CRLF & "control handle: " & @CRLF & $hWnd) EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
sandin Posted February 3, 2009 Author Share Posted February 3, 2009 gr8, tnx =) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll 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