Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
9 years ago

Discrepency between wndStyles value and sum of wndStyles components

I have a test to check if a field object is read-only. This works for all 1260 fields except one in my application. It reports that a SysListView32 is read only when it is not. The field is possibly a code-jock list.

 

My code looks something like

  if (testObj.WndStyles AND ES_READONLY) = ES_READONLY then
    log.Message("Field is read only")
  else
    log.Message("Field is NOT read only")
  end if

 

When I inspect the field's wndStyles properties the object spy tells me that it has the value 1342281729 (&H 50019801)

When I sum the components that the object spy reports

WS_CHILD OR WS_MAXIMIZEBOX OR WS_OVERLAPPED OR WS_TABSTOP OR WS_VISIBLE

I only get 1342242816 (&H 50010000)

 

The field is not read only and ES_READONLY (2048 or &H 800) should not be listed (which it isn't).

 

I do not understand why there is a discrepency between the wndStyles value that the object spy reports and the sum of the components it reports. Can you please help.

 

 

  • Hi MulgraveTester,

     

    Your list view appears to have the LVS_ALIGNLEFT style, which is also 0x800 = 2048. List views don't seem to have the "read-only" style. ES_READONLY applies only to edit controls, but not to list views.

     

    As for how Object Spy parses the WndStyles value - I guess it shows only the common WS_ constants and does not show control-specific constants, because in general there's no way to tell if 0x800 means ES_READONLY, LVS_ALIGNLEFT, CBS_DISABLENOSCROLL, or something else. Feel free to submit an enhancement request though.

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi MulgraveTester,

     

    Your list view appears to have the LVS_ALIGNLEFT style, which is also 0x800 = 2048. List views don't seem to have the "read-only" style. ES_READONLY applies only to edit controls, but not to list views.

     

    As for how Object Spy parses the WndStyles value - I guess it shows only the common WS_ constants and does not show control-specific constants, because in general there's no way to tell if 0x800 means ES_READONLY, LVS_ALIGNLEFT, CBS_DISABLENOSCROLL, or something else. Feel free to submit an enhancement request though.

    • MulgraveTester's avatar
      MulgraveTester
      Frequent Contributor

      Thanks. I wasn't aware of the other values that you mentioned. I guess I could test the object type before testing of it is read only.