User Button Notification Codes: BN_CLICKED, is there a way to get notification when it is unclicked?
-
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
-
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
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.
-
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.
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... -
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
If the button stays "in" after it has been clicked, it sounds as though you need to look at
BN_PUSHED
andBN_UNPUSHED
. If that won't work, you may have to use theBS_OWNERDRAW
button style and theDRAWITEMSTRUCT
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
-
If the button stays "in" after it has been clicked, it sounds as though you need to look at
BN_PUSHED
andBN_UNPUSHED
. If that won't work, you may have to use theBS_OWNERDRAW
button style and theDRAWITEMSTRUCT
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
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 -
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, PaulDid you set the "Notify" style on the static control?
If you vote me down, my score will only get lower
-
Did you set the "Notify" style on the static control?
If you vote me down, my score will only get lower
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