Sign in to follow this  
Followers 0
DennisChristensen

TcxCheckBox set and get checked state

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0