Forum Discussion

Dewayne_Pinion's avatar
Dewayne_Pinion
Contributor
10 years ago
Solved

Checking enabled property of toolstrip buttons not seeing correct state

Hello,

I have an issue that is causing me to pull my hair out :) I have a toolstrip with buttons for our general software commands (New/Open/Edit/Save/etc....). When I test the state of these buttons it never seems to compare correctly. My script sees the buttons as enabled even though they are not. Please see the images for reference:

 

Edit_menu_button.png

 

As you can see the edit button is disabled, and Object Spy correctly sees it this way. However:

 

Edit_menu_button2.png

 

As this image shows the check for true passes and the if statement resolves to true, so the next line is executed. This should not be happening. The check for true should fail as shown again in Object Spy, but it does not. Any ideas on what I could be doing wrong?

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • Hi Dewayne,

    Remove ; at the end of your if line:

     

    if (...... == true) ;

    The ; marks the end of the statement, so in this case if doesn't have the then-else parts.

2 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Dewayne,

    Remove ; at the end of your if line:

     

    if (...... == true) ;

    The ; marks the end of the statement, so in this case if doesn't have the then-else parts.