> From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
> > I'm trying to save the last focused control on a form so when I
reactivate
> > it This control has focus
>
> The focused control is TForm.ActiveControl, and when you call
Form1.SetFocus
> it calls Form1.ActiveControl.SetFocus internally. So normally this
happens
> for free...
>
If the default behaviour isn't working in your case you could try tracking
changes to focussed control as they happen by capturing Form.CM_FOCUSCHANGED
events. Set an internal variable remembering activecontrol each time
CM_FOCUSCHANGED occurs while self = screen.activeform. Ignore
CM_FOCUSCHANGED events which occur while self <> screen.activeform. So if
the form isn't the active form then your internal variable should contain
the control which was active last time the form was active.
Crude, but may work as a last resort if you can't get a reliable event for
form.deactivate.
Good luck,
David.
DB Solutions.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"