nacerbaaziz Posted February 4, 2018 Posted February 4, 2018 Detect if the focus item is a button or check box Hello everyone. My dears I have a problem When I try to use ControlGetFocus function it doesn't recognize the check boxes. The result is that the selector is a button Although the specified is a check box but I want a way to identify the check boxes. Because I want to make a tool that helps screen readers users I hope you have the solution. Thank you in advance.
Zedna Posted February 4, 2018 Posted February 4, 2018 (edited) button,checkbox,radiobutton,groupbox --> all these controls have the same ClassName "Button" and they differ only in STYLE. So you have to check its STYLE by $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) and test if it contains desired style ($BS_CHECKBOX) ... Edited February 4, 2018 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
nacerbaaziz Posted February 4, 2018 Author Posted February 4, 2018 thank you verry much can you give me a example if posible
Zedna Posted February 4, 2018 Posted February 4, 2018 Something like this: $focus_classnn = ControlGetFocus("...", "...") $focus_hwnd = ControlGetHandle("...", "...", "[ClassNN:" & $focus_classnn & "]") If IsCheckBox($focus_hwnd) Then ... Func IsCheckBox($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAnd($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc nacerbaaziz 1 Resources UDF ResourcesEx UDF AutoIt Forum Search
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