CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Location
    West Michigan
    Posts
    20

    Question How to determine cause of Enter event?

    I have a custom control. When focus is given to this control, the Enter event is triggered. Is there any way to determine what caused focus to come to this control (Tabbed in, Shift-tabbed in, mouse click)?

    My control has various items on it. Depending on what caused my control to gain focus, I'd like to highlight one of them. For example, if the user clicks on an item, that item will be highlighted. If the user tabbed in from another control, then the "first" item will be highlighted, but if it was a shift-tab, then the "last" item will be highlighted.

    Thanks for any help.
    --
    Scott

  2. #2
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    Re: How to determine cause of Enter event?

    you need to have handlers for each of those use cases. enter is a generic event handler (meaning no extra info about the event is passed in).

  3. #3
    Join Date
    Mar 2005
    Location
    West Michigan
    Posts
    20

    Re: How to determine cause of Enter event?

    Quote Originally Posted by MadHatter
    you need to have handlers for each of those use cases. enter is a generic event handler (meaning no extra info about the event is passed in).
    That is what I figured, and I do have a handler for clicking for focus (MouseDown event), but I don't see an event for getting focus via tabbing.

    I also though about watching for a click, followed by the focus event, but the focus event comes before the mouse down event. Anyone have an idea about how to do this?
    --
    Scott

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