S.G.K has asked for the wisdom of the Perl Monks concerning the following question:

Hi friends,
Can you tell me syntax to check whether a check box is grayed or not.
I tried Isgrayedbutton, and iswindowenable both are returning false in if condition. Help me. Thanks in advance.

Replies are listed 'Best First'.
Re: CheckBox grayed or not syntax
by jdporter (Paladin) on May 21, 2020 at 17:24 UTC

    What programming language are you using? What GUI framework?

Re: CheckBox grayed or not syntax
by marto (Cardinal) on May 21, 2020 at 18:33 UTC

    I guess you are using Win32::GuiTest? If so can you post the code you are using?

Re: CheckBox grayed or not syntax
by hippo (Archbishop) on May 22, 2020 at 08:55 UTC
    Help me.

    Here you go.

    #!/usr/bin/env perl use strict; use warnings; use Test::More tests => 2; use HTML::Parser::Simple::Attributes; my @attr = ( 'type="checkbox" disabled="disabled"', 'type="checkbox"' ); my($parser) = HTML::Parser::Simple::Attributes -> new; $parser->parse ($attr[0]); ok $parser->get ('disabled'); $parser->parse ($attr[1]); ok !$parser->get ('disabled');
Re: CheckBox grayed or not syntax
by jcb (Parson) on May 21, 2020 at 23:18 UTC

    Well neither of those sound like Tk to me, so I must join my fellow monks in asking which GUI framework you are using?

    BTW, in Tk, you would call the cget method on your Tk::Checkbutton widget and check the return value like this:

    if ($checkbutton->cget('-state') eq 'disabled') { # the checkbox is currently disabled }