Jump to content

3.2.4.4/3.2.4.5 Incompatibility?


Recommended Posts

I have a loop which looks at control ids.

The following statement:

If BitAND (GUICtrlGetState ($Control_ID), $GUI_HIDE) Then ContinueLoop

appears in the body of the loop to ignore a control if it is hidden. The loop is driven by a mouse move event.

In AutoIt 3.2.3.2 the IF condition did NOT test true for a ListView control when it was not hidden.

In AutoIt 3.2.4.5 the IF condition ALWAYS test true for a ListView control.

Looking at the documentation for GUICtrlGetState, it seems I was not using GUICtrlGetState correctly, due to this

note in the remarks:

Exceptions:

For ListView controls it returns the number of the clicked column.

Oops.

The question now is: How does one reliably test the state of a control, not knowing the type of the control? If GUICtrlSetState is used to disable a ListView control, how do you test the state of the control?

Link to comment
Share on other sites

Correct way is:

If BitAND (GUICtrlGetState ($Control_ID), $GUI_HIDE) = $GUI_HIDE Then ContinueLoop

Because your control can have more than one style.

I agree the above code is "better" (actually surprised I wrote it the way I did) in that it does not imply knowledge that the possible set of tested values are bit-oriented. In the case of styles/states, the values are bit-oriented (i.e. you BitOR styles as opposed to adding them) so only one or none of the bits is going to be on in the result.

I changed it anyway and it still always tests true for a ListView control in !!3.2.4.6!!

Thank you for your response. If I'm not thinking correctly, please tell me so -- it's been a long weekend!

Sincerely,

Paul

Link to comment
Share on other sites

A work-around for this is to borrow a statement from the Listview functions:

IF _IsClassName ($h_Source_listview, "SysListView32") Then Ingore test for disabled control

I still don't know how one would test for a disabled control though....

Link to comment
Share on other sites

A developer may want to take a look at this. Even though the documentation does state:

Exceptions:

For ListView controls it returns the number of the clicked column.

it seems to me to be an unfortunate inconsistency. Even though I have a work-around, there may be cases where someone would need to test the state of a listview control. I still don't know how to check if a listview control is enabled?

Link to comment
Share on other sites

Example:

ConsoleWrite(ControlCommand("ListView Delete All Items","","SysListView321","IsEnabled", "") & @LF)
GUICtrlSetState($listview, $GUI_DISABLE)
ConsoleWrite(ControlCommand("ListView Delete All Items","","SysListView321","IsEnabled", "") & @LF)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I agree the above code is "better" (actually surprised I wrote it the way I did) in that it does not imply knowledge that the possible set of tested values are bit-oriented. In the case of styles/states, the values are bit-oriented (i.e. you BitOR styles as opposed to adding them) so only one or none of the bits is going to be on in the result.

I changed it anyway and it still always tests true for a ListView control in !!3.2.4.6!!

Thank you for your response. If I'm not thinking correctly, please tell me so -- it's been a long weekend!

Sincerely,

Paul

The above reply (by me) was in response to the previous reply by Zedna. I believe Zedna's reply was CORRECT, and my reply was incorrect. It appears from the AutoIt documentation that CONTROL styles can be summed up, whereas Window styles may not, implying Window styles are indeed bit-oriented, but NOT control styles as I stated.

Therefore, writing:

If BitAND (GUICtrlGetState ($Control_ID), $GUI_HIDE) Then ContinueLoopoÝ÷ ØÚ-zØZµ«­¢+Ù%9½Ð  ¥Ñ9¡]¥¹ÑMÑÑ ÀÌØíAÉ´¤°È¤Q¡¸IÑÕɸ±Í
IS valid because Window styles are bit-oriented.

I point this out because I appreciate this forum and the last thing I would want to do is mislead someone or state something with affirmation that is incorrect.

The original point of this thread is that: GUICtrlGetState ($Control_ID), $GUI_HIDE) = $GUI_HIDE is an invalid test if the control_ID identifies a listview control. This IS stated in the AutoIt documentation.

Sincerely,

Paul

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...