Andrew,
>I'm using MM v. 1.4.1 with Infragistics controls but the problem has been reproduced using plain MM controls.
>
>I'm having some problems with setting focus on a control when a form loads. The control that I want to get the focus on form load does not get it if I use the SetFocus method (called from my bizForm's Load event) or set the FocusOnLoadControl.
I've been stewing on this one for a while and have finally come up with a solution. For some reason the SetFocus() method works great at any other time but form load. To get a control to have focus at form load you need to use the form's ActiveControl property like this:
Form ParentForm = mmAppDesktop.FormMgr.GetParentForm(this.FocusOnLoadControl);
ParentForm.ActiveControl = this.FocusOnLoadControl;
ParentForm.ActiveControl.Focus();
I have added a new overload of SetFocus() to mmBaseForm that allows you to specify if you are setting focus during form load. If so, it uses this new methodology. Otherwise it uses the standard method.
For now you can put this code in your application form's load (remember to check if FocusOnLoadControl is null).
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com