Search the Community
Showing results for tags 'mouse hover'.
-
#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> Example() Func Example() local $hGui = GUICreate("My GUI menu", 300, 200) Local $idFilemenu = GUICtrlCreateMenu("&File") Local $idFileitem = GUICtrlCreateMenuItem("Open", $idFilemenu) Local $idHelpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $idFilemenu) GUICtrlSetState(-1, $GUI_DISABLE) Local $idInfoitem = GUICtrlCreateMenuItem("Info", $idHelpmenu) Local $idExititem = GUICtrlCreateMenuItem("Exit", $idFilemenu) Local $idRecentfilesmenu = GUICtrlCreateMenu("Recent Files", $idFilemenu, 1) Local $idViewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu Local $idViewstatusitem = GUICtrlCreateMenuItem("Statusbar", $idViewmenu) GUICtrlSetState(-1, $GUI_CHECKED) Local $idButton_1 = GUICtrlCreateButton("Button 1", 50, 130, 70, 20) Local $idButton_2 = GUICtrlCreateButton("Button 2", 180, 130, 70, 20) GUISetState(@SW_SHOW) Local $sFile Local $tPoint = GUIGetCursorInfo() Local $hWnd1 = ControlGetHandle(WinGetHandle($hGui), "", $idButton_1) Local $hWnd2 = ControlGetHandle(WinGetHandle($hGui), "", $idFilemenu) While 1 $tPoint = _WinAPI_GetMousePos() If _WinAPI_WindowFromPoint($tPoint) = $hWnd1 Then GUICtrlSetState($idButton_2, $GUI_HIDE) ElseIf _WinAPI_WindowFromPoint($tPoint) = $hWnd2 Then ; Got PROBLEM at here GUICtrlSetState($idButton_2, $GUI_HIDE) Else GUICtrlSetState($idButton_2, $GUI_SHOW) EndIf Switch GUIGetMsg() Case $idFileitem $sFile = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($sFile, $idRecentfilesmenu) Case $idViewstatusitem If BitAND(GUICtrlRead($idViewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($idViewstatusitem, $GUI_UNCHECKED) Else GUICtrlSetState($idViewstatusitem, $GUI_CHECKED) EndIf Case $GUI_EVENT_CLOSE, $idExititem ExitLoop Case $idInfoitem MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") EndSwitch WEnd GUIDelete() EndFunc Hi, I got stuck at mouse hover problem. This is my code. From the code, you can see when mouse hover on Button 1, Button 2 will be hided. But when mouse hover on the File Menu, Button 2 doesn't work. I think the main reason is due to the File Menu's control ID cannot be detected. I used the AutoIT Info Tool also can't detected the Menu bar. Appreciate if anybody can help. Thank you.New AutoIt v3 Script.au3