Click to See Complete Forum and Search --> : Last Active Control


August 22nd, 1999, 05:14 PM
I have a question regarding the last active control on a form. When a control_1 get the focus, is it possible to know which control had the focus right before the control_1 becoming active?

Thank you for any reply

Alex

Jan Businger
August 23rd, 1999, 01:37 AM
Hi,
Interesting question.
I suggest you to write code to the lost_focus events from all controls.
Add a label control or a messagebox, whatever
you think is best to be informed


Private Sub CommandX_LostFocus()
-Label1.Caption = "CommandX was previous.."
0r
MsgBox "ditto........."

End Sub

Maybe Lothar or Chris have better suggestions.

Jan

Chris Eastwood
August 23rd, 1999, 03:23 AM
This is a toughie....

I remember writing something years ago that tracked all of the controls that had focus and in which order, but then that was all ruined when I realised that the whole application can lose focus to another program (doh !) and the user could then just jump back to the app by clicking on a control.

Good Luck


Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb

August 23rd, 1999, 10:03 AM
Thank you for the reply.

It seems no better way.

Alex

August 23rd, 1999, 10:11 AM
Thanks for the reply.

Maybe I should give the detail and to see if there are ways to get around.

I have a flexgrid control, a button and other controls on a form. The flexgrid was filled with records. I want to press the button to display the detail info of the selected record in the flexgrid. The trouble is, even the the focus is on other control when I press the button, the detail info of a record get diplayed because of the grid.row property is on.

Thanks,
Alex