Results 1 to 4 of 4

Thread: [RESOLVED] Usercontrols and Tabindex's...

  1. #1

    Thread Starter
    Member mOBSCENE's Avatar
    Join Date
    Mar 2009
    Location
    New Jersey
    Posts
    46

    Resolved [RESOLVED] Usercontrols and Tabindex's...

    I have this usercontrol that highlights itself when focus is set on it. The only problem is when it is the 0'th tabindex on a form... It doesn't highlight... It's heavily subclassed, and it does everything in its power to make sure it highlights when a user hovers it, or clicks on it. The highlight is executed upon focus, or mouseover. It is removed on mouseleave, and lostfocus. That all works fine.

    If the tabindex IS 0, the focus wont be brought on until the user types something, or mouseovers it. I'd like some sort of way to know what the tabindex is :S

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Usercontrols and Tabindex's...

    This seems to work:
    Code:
    Private Sub UserControl_Resize()
     Debug.Print UserControl.Extender.TabIndex
    End Sub

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Usercontrols and Tabindex's...

    I would suggest avoiding using the Extender object unless this control will only be used in VB environments. Other environments may not support/supply a tabindex property.

    P.S. If your control can get focus, is not hidden or disabled and is tab index zero, then it should be the control to get focus when the form first loads and is displayed. Additionally, you should get events firing too. For example, this uc (tabindex=0) fired these events when the project was run:
    Code:
    Initialize
    ReadProperties
    Resize: 1950, 1230
    EnterFocus
    GotFocus
    Paint
    Note: If your uc has controls inside of it that get focus (i.e., textboxes, etc), then the GotFocus event may not fire, but the EnterFocus should. Maybe you need to concentrate on EnterFocus/ExitFocus vs GotFocus/LostFocus ?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    Member mOBSCENE's Avatar
    Join Date
    Mar 2009
    Location
    New Jersey
    Posts
    46

    Re: Usercontrols and Tabindex's...

    I took the things that you've both said into consideration. I used an if statement in the Paint event, to check if UserControl.Extender.TabIndex = 0, and if so, and if it's not in the IDE, then highlight.

    Thanks guys.

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