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. User Button Notification Codes: BN_CLICKED, is there a way to get notification when it is unclicked?

User Button Notification Codes: BN_CLICKED, is there a way to get notification when it is unclicked?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
7 Posts 4 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.
  • P Offline
    P Offline
    Paul Belikian
    wrote on last edited by
    #1

    Hello all, VC6, MFC, XP My application has a Formview based view with many static controls all over it. The CStatic controls are used in a similar fashion as CButtons are used: The user makes selections by pressing on them. I really do have my reasons for not using the CButton control, but even if I were to use it, I need to find a way to get notified when the 'button' is released. When they are pressed, I do get the BN_CLICKED messages, but I can not find any messages (in WinUser.h) that could be returned when the buttons are released. Is there such a message? Any suggestions or tips to get or simulate this message would be appreciated and be a great help! I'm working with a timer based work around, however the application really needs to track exactly how long the button is down. Best Regards, Paul

    L D 2 Replies Last reply
    0
    • P Paul Belikian

      Hello all, VC6, MFC, XP My application has a Formview based view with many static controls all over it. The CStatic controls are used in a similar fashion as CButtons are used: The user makes selections by pressing on them. I really do have my reasons for not using the CButton control, but even if I were to use it, I need to find a way to get notified when the 'button' is released. When they are pressed, I do get the BN_CLICKED messages, but I can not find any messages (in WinUser.h) that could be returned when the buttons are released. Is there such a message? Any suggestions or tips to get or simulate this message would be appreciated and be a great help! I'm working with a timer based work around, however the application really needs to track exactly how long the button is down. Best Regards, Paul

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      I don't remember the details, however there is bound to be some mouse down and mouse up events. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      P 1 Reply Last reply
      0
      • L Luc Pattyn

        I don't remember the details, however there is bound to be some mouse down and mouse up events. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        P Offline
        P Offline
        Paul Belikian
        wrote on last edited by
        #3

        Yes thank you! I was playing with those in the static derived class - I need to be able to forward those messages in a similar manner and form as the BS_CLICKED message. In other words, the View handles the message in the following fashion: ON_CONTROL(BN_UNCLICKED, ID_BUTTONx, OnButtonUnClicked) afx_msg void OnButtonUnClicked(UINT nID) Now if I can only find the parameters in the SendMessage function to send such a message above...

        1 Reply Last reply
        0
        • P Paul Belikian

          Hello all, VC6, MFC, XP My application has a Formview based view with many static controls all over it. The CStatic controls are used in a similar fashion as CButtons are used: The user makes selections by pressing on them. I really do have my reasons for not using the CButton control, but even if I were to use it, I need to find a way to get notified when the 'button' is released. When they are pressed, I do get the BN_CLICKED messages, but I can not find any messages (in WinUser.h) that could be returned when the buttons are released. Is there such a message? Any suggestions or tips to get or simulate this message would be appreciated and be a great help! I'm working with a timer based work around, however the application really needs to track exactly how long the button is down. Best Regards, Paul

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          If the button stays "in" after it has been clicked, it sounds as though you need to look at BN_PUSHED and BN_UNPUSHED. If that won't work, you may have to use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          P 1 Reply Last reply
          0
          • D David Crow

            If the button stays "in" after it has been clicked, it sounds as though you need to look at BN_PUSHED and BN_UNPUSHED. If that won't work, you may have to use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            P Offline
            P Offline
            Paul Belikian
            wrote on last edited by
            #5

            Hello David, Thank you for replying. BN_UNPUSHED was the first thing I tried, yet I wouldn't get the notification. I suspect that notification isn't sent for static controls like it is sent for button controls. :| Regards, Paul

            R 1 Reply Last reply
            0
            • P Paul Belikian

              Hello David, Thank you for replying. BN_UNPUSHED was the first thing I tried, yet I wouldn't get the notification. I suspect that notification isn't sent for static controls like it is sent for button controls. :| Regards, Paul

              R Offline
              R Offline
              Roger Allen
              wrote on last edited by
              #6

              Did you set the "Notify" style on the static control?

              If you vote me down, my score will only get lower

              P 1 Reply Last reply
              0
              • R Roger Allen

                Did you set the "Notify" style on the static control?

                If you vote me down, my score will only get lower

                P Offline
                P Offline
                Paul Belikian
                wrote on last edited by
                #7

                Hi Roger - Really appreciate your articles, I've learned quite a few things from reading them! ;) The static controls are created dynamically; I specify the following as the style: #define DEFAULT_STATIC_STYLE ES_CENTER|WS_BORDER|BS_NOTIFY I do get the BN_CLICKED notifications, but not the BN_UNPUSHED notifications. Is there another flag that I need to set? I don't believe so, I suspect the CStatic control doesn't send that type of notification. :wtf: Thank you, Paul

                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