DennisChristensen Posted April 19, 2011 Share Posted April 19, 2011 Hi I am using AutoIt to test an application developed in Delphi using Developer Express VCL Components. I need to check/uncheck a TcxCheckBox and read whether it is checked/unchecked. The standard VCL TCheckBox can be set using: ControlCommand($win, "", $ctrl, "Check") / ControlCommand($win, "", $ctrl, "UnCheck") and read by $res = ControlCommand($win, "", $ctrl, "isChecked") But this does not work with TcxCheckBox. I can toggle between checked/unchecked with ControlSend($win, "", $ctrl, "{SPACE}") but I have not found a way to read the checked state. Do you have some suggestions / hints? Thanks Dennis Christensen Link to comment Share on other sites More sharing options...
wakillon Posted April 19, 2011 Share Posted April 19, 2011 Some controls will resist automation unless they are the active window. Use the WinActive() function to force the control's window to the top before using ControlCommand() on these controls AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DennisChristensen Posted April 20, 2011 Author Share Posted April 20, 2011 Hi <Use the WinActive() function to force the control's window to the top before using ControlCommand() on these controls Thanks. Unfortunately this is not enough. I tried testing a bit more. The AutoIt ControlCommand function sends BM_GETSTATE and BM_SETSTATE messages to the CheckBox, but the DevExpress TcxCheckBox does not seem to respond to them (the standard Delphi TCheckBox does). Any ideas? Best regards Dennis Link to comment Share on other sites More sharing options...
DennisChristensen Posted April 26, 2011 Author Share Posted April 26, 2011 Hi All I cannot think of anything else than taking a screendump of the TcxCheckbox and compare it to known dumps of how it looks when checked and not checked. Can you think of anything else? Is there a codesnippet somewhere showing how to do it in AutoIt? Best regards Dennis Link to comment Share on other sites More sharing options...
wakillon Posted April 26, 2011 Share Posted April 26, 2011 ControlCommand is a good solution, but maybe Check CtrlId is wrong. _GetCheckState ( 'Title', $_CtrlId ) Func _GetCheckState ( $_GuiTitle, $_Check ) Return ControlCommand ( $_GuiTitle, "", $_Check, "IsChecked", "" ) EndFunc ;==> _GetCheckState ( ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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