>How can I know which control is in the focus at present? I tried with Activecontrol but somehow clould not get it.
>
>Regards to all.
Suppose, you want to restore focus on control, which had focus before, after you click on some button.
Add a new property to your form, say, oLastFocus (this would hold the object reference to the object, which currently has focus). Assign null to it in property sheet.
In button when event:
if type('thisform.ActiveControl')='O'
thisform.oLastFocus=thisform.ActiveControl
else
thisform.oLastFocus=null
endif
In button click:
Do your usual code
if not isnull(thisform.oLastFocus)
thisform.oLastFocus.SetFocus()
endif
In form destroy event add
thisform.oLastFocus=null
Everything is off the top of my head and not tested, so you can take it as an idea.
Hope this helps.
If it's not broken, fix it until it is.
My Blog