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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Prgramatically Press a CButton

Prgramatically Press a CButton

Scheduled Pinned Locked Moved C / C++ / MFC
csharphardwarequestion
3 Posts 3 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
    Jawache
    wrote on last edited by
    #1

    I am doing to embedded programming with a footswitch, I want a CButton to be 'pressed' when the footswitch is pressed and released when the footswitch is released? Does anyone know how I can programatically give the CButton the 'Pressed' look? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

    R B 2 Replies Last reply
    0
    • J Jawache

      I am doing to embedded programming with a footswitch, I want a CButton to be 'pressed' when the footswitch is pressed and released when the footswitch is released? Does anyone know how I can programatically give the CButton the 'Pressed' look? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      I suggest creating an owner drawn button that draws itself as pressed when it's truly pressed as well as when it's pressed property is true. Them it's a simple matter of doing:

      m_button.setPressed (true);
      m_button.Invalidate(); // these calls could/should be
      m_button.UpdateWindow(); // included in setPressed()

      /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com

      1 Reply Last reply
      0
      • J Jawache

        I am doing to embedded programming with a footswitch, I want a CButton to be 'pressed' when the footswitch is pressed and released when the footswitch is released? Does anyone know how I can programatically give the CButton the 'Pressed' look? Cheers Asim Hussain e: asim@jawache.net w: www.jawache.net

        B Offline
        B Offline
        Big Art
        wrote on last edited by
        #3

        When you want to have the program press the button use: ::SendMessage(hwBtn,BM_CLICK,0,0); Art

        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