468,484 Members | 2,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

Capturing Right click on dynamically created buttons MFC.

464 Expert 256MB
I have a MFC dialog in which buttons get dynamically created on the page. I use a ON_CONTROL_RANGE(BN_CLICKED, 10000,10500, OnBnClicked) and this captures any left click on the button and it works great. I now want to handle right click on these buttons. Is there a way in which i can capture the right click on an ID range given above? or do i need to capture the NM_RCLICK and see if the mouse point is in any of my button's rect (using ptinrect())?

I tried to use the ON_NOTIFY_RANGE(NM_RCLICK, 10000, 10500, OnRClicked),but this isn't generating the message. I am using that message wrong?
Nov 20 '07 #1
3 4573
weaknessforcats
9,207 Expert Mod 8TB
I am not an expert here, but I assume you have a NM_RCLICK handler in your WinProc otherwise it will go to default.
Nov 20 '07 #2
I have a MFC dialog in which buttons get dynamically created on the page. I use a ON_CONTROL_RANGE(BN_CLICKED, 10000,10500, OnBnClicked) and this captures any left click on the button and it works great. I now want to handle right click on these buttons. Is there a way in which i can capture the right click on an ID range given above? or do i need to capture the NM_RCLICK and see if the mouse point is in any of my button's rect (using ptinrect())?

I tried to use the ON_NOTIFY_RANGE(NM_RCLICK, 10000, 10500, OnRClicked),but this isn't generating the message. I am using that message wrong?
A right click on a button? Sounds like you will have to subclass your buttons.
Nov 20 '07 #3
Studlyami
464 Expert 256MB
A right click on a button? Sounds like you will have to subclass your buttons.
Thanks for the suggestion. I sub classed the CButton then i was able to capture the ON_WM_RBUTTON commands.
Nov 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Chris Windsor | last post: by
5 posts views Thread by Jack Johnston | last post: by
2 posts views Thread by Liqun Xu | last post: by
2 posts views Thread by Michael Johnson Jr. | last post: by
11 posts views Thread by Terry Olsen | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.