Track all enter and leave Message from Controls

  • Thread starter Thread starter Peter Schneider
  • Start date Start date
P

Peter Schneider

Hi there

it is possible to track all "enter" and "leave" messages from all Forms
controls with one routine?

Peter
 
Peter,

When you say all forms, do you mean all forms in your application? If
this is the case, then I would say yes. You could do it with a windows
hook, or by handling all windows messages that go to the forms, but there is
an easier way. All you have to do is have one event handler method, and
attach it to all of the form's Enter and Leave events. That way, you have
one handler that handles the event for everything that it is attached to.

This is where the beauty of the event model really shines, because it
allows you to compact code in this manner, and write more generic routines,
as you want to do in your situation.

Hope this helps.
 
Hi Nicholas

thanks for answer, (sorry) but i mean >>it is possible to track all "enter"
and "leave" messages from all controls on the form.
I try to work with "Extender Providers", and hook into the control.

Peter


Nicholas Paldino said:
Peter,

When you say all forms, do you mean all forms in your application? If
this is the case, then I would say yes. You could do it with a windows
hook, or by handling all windows messages that go to the forms, but there is
an easier way. All you have to do is have one event handler method, and
attach it to all of the form's Enter and Leave events. That way, you have
one handler that handles the event for everything that it is attached to.

This is where the beauty of the event model really shines, because it
allows you to compact code in this manner, and write more generic routines,
as you want to do in your situation.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Peter Schneider said:
Hi there

it is possible to track all "enter" and "leave" messages from all Forms
controls with one routine?

Peter
 
Peter,

Yes, this is possible. If you have access to the Form, then you can
cycle through the Controls collection, and attach to every Enter and Leave
event on the form. The Enter and Leave events are defined on the Control
level.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Peter Schneider said:
Hi Nicholas

thanks for answer, (sorry) but i mean >>it is possible to track all "enter"
and "leave" messages from all controls on the form.
I try to work with "Extender Providers", and hook into the control.

Peter


Nicholas Paldino said:
Peter,

When you say all forms, do you mean all forms in your application? If
this is the case, then I would say yes. You could do it with a windows
hook, or by handling all windows messages that go to the forms, but
there
is
an easier way. All you have to do is have one event handler method, and
attach it to all of the form's Enter and Leave events. That way, you have
one handler that handles the event for everything that it is attached to.

This is where the beauty of the event model really shines, because it
allows you to compact code in this manner, and write more generic routines,
as you want to do in your situation.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Peter Schneider said:
Hi there

it is possible to track all "enter" and "leave" messages from all Forms
controls with one routine?

Peter
 
Back
Top