473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 5054
weaknessforcats
9,208 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

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

Similar topics

7
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically...
2
by: Chris Windsor | last post by:
I hope the following describe what I'm trying to do: I have created a tool to be used by product analysts when studying different cell phone designs. Part of the tool is a set of 11 forms on a...
5
by: Jack Johnston | last post by:
Hi there, I am dynamically created a table at runtime on an aspx form. The last cell of each row contains a TextBox in which the user will enter numeric values into. Each textbox I create is...
2
by: Liqun Xu | last post by:
Hallo NG, I created a Button with Click-Event dynamically: System.Web.UI.WebControls.Button bt_1 = new Button(); bt_1.Click += new EventHandler(bt_1_click); and I implemented the Funktion...
2
by: Michael Johnson Jr. | last post by:
here is the problem, I have a table with dynamic buttons and events. On buton click of said row, it would clear the rows in the table, and repopulate it. This works fine the first time you run...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
3
by: Mark | last post by:
Assume you want to dynamically add one to many link button controls to a web page dynamically at run time. Each link button needs to post back and execute code. As the link buttons are created at...
2
by: dperren | last post by:
At current, I have a set of dynamically generated image buttons, which are created with this (excert) of code: TableCell tasks = new TableCell(); while (reader.Read()) { ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.