|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Form level focus monitorI would like to write a routine that will monitor every focus change on the
form and report the name of the control that got focus. I know I could put code in the gotfocus event of every control and call a central routine, but is there a way to monitor gotfocus events from one central form level procedure? Thanks, -Steve "Steve" <Steve@nospam.com> wrote in message Not that I'm aware of. What you can do, though, is something similar to news:e3ZEP6jEHHA.4680@TK2MSFTNGP04.phx.gbl... >I would like to write a routine that will monitor every focus change on the >form and report the name of the control that got focus. I know I could put >code in the gotfocus event of every control and call a central routine, but >is there a way to monitor gotfocus events from one central form level >procedure? > > Thanks, > > -Steve > > your gotfocus event handler. Create a procedure with the same signature as your gotfocus event. In your form load event, loop through all controls on the form (that you want to log when they get the focus) and attach the got focus event to the procedure you created above. Have this procedure monitor/log your focus. HTH, Mythran
Show quote
Hide quote
"Mythran" <kip_pot***@hotmail.com> wrote in message Sounds like a good idea. Problem is that I'm not sure how to attach the got news:eu1R3rkEHHA.4208@TK2MSFTNGP03.phx.gbl... > > > "Steve" <Steve@nospam.com> wrote in message > news:e3ZEP6jEHHA.4680@TK2MSFTNGP04.phx.gbl... >>I would like to write a routine that will monitor every focus change on >>the form and report the name of the control that got focus. I know I could >>put code in the gotfocus event of every control and call a central >>routine, but is there a way to monitor gotfocus events from one central >>form level procedure? >> >> Thanks, >> >> -Steve >> >> > > Not that I'm aware of. What you can do, though, is something similar to > your gotfocus event handler. Create a procedure with the same signature > as your gotfocus event. In your form load event, loop through all > controls on the form (that you want to log when they get the focus) and > attach the got focus event to the procedure you created above. Have this > procedure monitor/log your focus. > > HTH, > Mythran > > Thanks Mythran, focus event to the procedure. Could I impose on you for some sample code or a hint at where to look in MSDN? Thanks again, Steve
Show quote
Hide quote
"Steve" <Steve@nospam.com> wrote in message Sure, try AddHandler and RemoveHandler :) Look those up in MSDN..news:O3LKZTlEHHA.4952@TK2MSFTNGP06.phx.gbl... > > "Mythran" <kip_pot***@hotmail.com> wrote in message > news:eu1R3rkEHHA.4208@TK2MSFTNGP03.phx.gbl... >> >> >> "Steve" <Steve@nospam.com> wrote in message >> news:e3ZEP6jEHHA.4680@TK2MSFTNGP04.phx.gbl... >>>I would like to write a routine that will monitor every focus change on >>>the form and report the name of the control that got focus. I know I >>>could put code in the gotfocus event of every control and call a central >>>routine, but is there a way to monitor gotfocus events from one central >>>form level procedure? >>> >>> Thanks, >>> >>> -Steve >>> >>> >> >> Not that I'm aware of. What you can do, though, is something similar to >> your gotfocus event handler. Create a procedure with the same signature >> as your gotfocus event. In your form load event, loop through all >> controls on the form (that you want to log when they get the focus) and >> attach the got focus event to the procedure you created above. Have this >> procedure monitor/log your focus. >> >> HTH, >> Mythran >> >> > Thanks Mythran, > > Sounds like a good idea. Problem is that I'm not sure how to attach the > got focus event to the procedure. > Could I impose on you for some sample code or a hint at where to look in > MSDN? > > Thanks again, > > Steve > > > HTH, Mythran
Show quote
Hide quote
"Mythran" <kip_pot***@hotmail.com> wrote in message Just what I was looking for. Thanks again.news:O4WzWfmEHHA.4832@TK2MSFTNGP06.phx.gbl... > > > "Steve" <Steve@nospam.com> wrote in message > news:O3LKZTlEHHA.4952@TK2MSFTNGP06.phx.gbl... >> >> "Mythran" <kip_pot***@hotmail.com> wrote in message >> news:eu1R3rkEHHA.4208@TK2MSFTNGP03.phx.gbl... >>> >>> >>> "Steve" <Steve@nospam.com> wrote in message >>> news:e3ZEP6jEHHA.4680@TK2MSFTNGP04.phx.gbl... >>>>I would like to write a routine that will monitor every focus change on >>>>the form and report the name of the control that got focus. I know I >>>>could put code in the gotfocus event of every control and call a central >>>>routine, but is there a way to monitor gotfocus events from one central >>>>form level procedure? >>>> >>>> Thanks, >>>> >>>> -Steve >>>> >>>> >>> >>> Not that I'm aware of. What you can do, though, is something similar to >>> your gotfocus event handler. Create a procedure with the same signature >>> as your gotfocus event. In your form load event, loop through all >>> controls on the form (that you want to log when they get the focus) and >>> attach the got focus event to the procedure you created above. Have >>> this procedure monitor/log your focus. >>> >>> HTH, >>> Mythran >>> >>> >> Thanks Mythran, >> >> Sounds like a good idea. Problem is that I'm not sure how to attach the >> got focus event to the procedure. >> Could I impose on you for some sample code or a hint at where to look in >> MSDN? >> >> Thanks again, >> >> Steve >> >> >> > > Sure, try AddHandler and RemoveHandler :) Look those up in MSDN.. > > HTH, > Mythran > > -Steve |
|||||||||||||||||||||||