Re: Problem with Event handling in a custom control
If you use ON_CONTROL_RANGE the ID of the clicked item will be passed to
the function. So you wouldn't have to find out which control was clicked.
Therefore it wouldn't effect the performance by much, it think only the
stack pushes would make it a little slower, but unnoticeable by a human in
this scenario.
Keep in mind that you can only catch the events for direct children of a
window.
AliR.
"Venkat Mandela" <venkat.mandela@gmail.com> wrote in message
news:0ec56c8c-1a1f-48ca-85d1-c1857e3eb29c@u12g2000prd.googlegroups.com...
The choice between runtime and design time was subjective, partly due
to the curiosity to see how it can be done at runtime.
I have a large number of controls(40-45) of the same type
distributed across tab pages. These tab pages are nested in some
cases. If I map the event handler of all these controls to the same
function and then find the clicked button within the event handler,
will the response be slower?
regards,
Venkat
On May 19, 8:50 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
First, why are you doing this at runtime and not design time?
Second, if you have to do it at run time, select a specific range, such as
10000-10100 and
use an
ON_..._RANGE
macro in your message map. As to which range, it dpeends on what
notifications you are
sending.
joe
On Sun, 18 May 2008 22:19:59 -0700 (PDT), Venkat Mandela
<venkat.mand...@gmail.com> wrote:
Hi,
I am building a GUI which uses the same combination of controls at
multiple locations. For example, it has a custom gauge. This has a
progress bar, a button ( allows the user to display the peak/rms/
instantaneous value of the parameter) and a label displaying the
value. All three controls are surrounded by a group box. This
combination is used on multiple tabs. To make my job easier, I built a
custom control.
I am able to layout the controls correctly but I am facing a problem
when trying to handle the button click events. As I am assigning the
resource ID to the button on initialization, I am unable to add the
handler to the message map. Is there a workaround for this problem? Is
it possible to add an event handler at runtime in MFC?
thanks and regards,
Venkat
Joseph M. Newcomer [MVP]
email: newco...@flounder.com
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm