CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    Last Active Control

    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


  2. #2
    Join Date
    Jun 1999
    Location
    Switzerland
    Posts
    58

    Re: Last Active Control

    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


  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Last Active Control

    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

  4. #4
    Guest

    Re: Last Active Control

    Thank you for the reply.

    It seems no better way.

    Alex


  5. #5
    Guest

    Re: Last Active Control

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured