Results 1 to 7 of 7

Thread: ActiveX Focus problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    ActiveX Focus problem

    I am designing an ActiveX control which is a control container that can get focus, however, I can't figure out how to keep the focus on the control when one of it's contained controls recieves focus. In fact, it doesn't need to have focus really, but I want it to visually look like it does as long as it's child controls has the focus. So maybe, if there's some way to check if the control that currently has focus is contained in my control.

    Any help would be greatly appreciated.
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Have you tried using the Enter/ExitFocus events of your control?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207
    Yeah, I've tried those. Both the ExitFocus and LostFocus are called when focus is taken from my control, even when one of the controls it contains is given focus, so there is no way to differentiate between controls that are contained by my control and controls that are outside of it.
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

  4. #4
    Addicted Member
    Join Date
    Apr 2002
    Posts
    235
    So, users will add controls into your control, is that right?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207
    yes.

    To be more specific, it's similar to the standar frame control, only it's a type of bevel that has a titlebar style where when that frame (or one of the controls therin) has focus, the title bar shows an "Active" color, otherwise it shows the "Inactive" color.
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

  6. #6
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Try this...When the ExitFocus or LostFocus event is fired, loop through the UserControl.ContainedControls collection to see if the active control is in your group. If it is, retain the "focus" look. If not, switch to the "unfocus" look.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207
    Yeah, that's actually where I've left off... stumped. I know how to loop through all the UserControl.ContainedControls, but, I don't know how to check if it has focus. (ie UserControl.ContainedControls(x).SomeMethodToCheckFocus. Perhaps an API of some sort? I'm don't want to access a property or method that only some controls have.

    Thanks for all your help by the way.
    Micah Carrick
    Visual Basic 6 SP5
    Visual Basic.NET
    Quixotix Software
    [email protected]
    Download QCM 1.0 - Intelligent ActiveX Control Management

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