delphi - How to tell a non-modal has lost/regained focus -
i have main form , secondary form both dbaware controls common database. using showmodal able use modal go main form , navigate database.
in secondary can replace tdbedits tedits , stuff them data when show secondary form. there no means of navigating database in secondary form, but, if user can go main form can navigate, need reset database cursor when return secondary.
how can tell secondary form has lost focus? can grab database cursor position.
how can tell when secondary form gets focus again? can reset database cursor if moved before returning.
thanks p.s. please no questions on why and/or alternative suggestions. existing application , not want have fix miles of code. crappy is, has been working years , customer wants change of possible. :)
use form's onactivate
, ondeactivate
events. onactivate
called when form gains focus, , ondeactivate
called when loses it.
note these events triggered when focus transferred within own application. if need know when application loses or gains focus, use tapplication.onactivate
, tapplication.ondeactivate
instead.
Comments
Post a Comment