Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ODS_SELECTED

ODS_SELECTED

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    I am drawing (ownerdraw) a button. I used if ( (state & ODS_SELECTED) || (state & ODS_FOCUS )) { } to check selected state. Problem is this....If I call BN_CLICKED from parent window then control does not come into above condition but if I click button its working fine. Please suggest how to set state to ODS_SELECTED?

    J 1 Reply Last reply
    0
    • J john5632

      I am drawing (ownerdraw) a button. I used if ( (state & ODS_SELECTED) || (state & ODS_FOCUS )) { } to check selected state. Problem is this....If I call BN_CLICKED from parent window then control does not come into above condition but if I click button its working fine. Please suggest how to set state to ODS_SELECTED?

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      The BN_CLICKED message is send to the parent window of a button when it is clicked. It is send by the button control, not to it. If you want to simulate a button click, send the BM_CLICK[^] message to the button control.

      J 1 Reply Last reply
      0
      • J Jochen Arndt

        The BN_CLICKED message is send to the parent window of a button when it is clicked. It is send by the button control, not to it. If you want to simulate a button click, send the BM_CLICK[^] message to the button control.

        J Offline
        J Offline
        john5632
        wrote on last edited by
        #3

        It is fine but it does not solve my issue. I am calling as you said but still contols dont go into that condition. I also tried to set SetFocus() function but no luck!!!

        J 1 Reply Last reply
        0
        • J john5632

          It is fine but it does not solve my issue. I am calling as you said but still contols dont go into that condition. I also tried to set SetFocus() function but no luck!!!

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          I have just tested it with an owner draw button in one of my applications. When BM_CLICK is send and the button did not had the focus, the DrawItem() member function is called with the ODS_FOCUS state bit set. The same applies when calling the SetFocus() member function of the button. So it seems that there is another error in your code. You may set a break point in your DrawItem() function and/or write the state to the debug window using trace() to check when and with which states your drawing function is called.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups