CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2009
    Posts
    34

    [RESOLVED] Controlling TABSTOP

    Hello.

    I have a simple form that contains a couple of textboxes and a group of 3 radio buttons.

    I want the focus to go back and forth between the two textboxes only when the user clicks on the TAB key.

    Unfortunately, the selected radiobutton is also getting the focus using TAB although I cannot find any property to disable this.

    How can I prevent the radiobutton from getting focus using TAB?

    Thanks.

  2. #2
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Controlling TABSTOP

    You mean this isn't enough?
    It's not a bug, it's a feature!

  3. #3
    Join Date
    May 2009
    Posts
    34

    Re: Controlling TABSTOP

    It would be if such an event actually showed up in the event list for the radio button, which is appears not to.

    Anyway, an answer was provided at another site shown below:

    "RadioButton.TabStop property is infrastructure and is set dynamically at runtime to allow tabbing directly into checked radio and out of radio group again.
    The best option to prevent tabstopping to radiobuttons is to select Enter event handler for all radios and call SelectNextControl method to auto select next control in tab order."

    So I added this code in the ENTER event:

    Control ctl;
    ctl = (Control)sender;
    this.SelectNextControl(ctl, true, true, true, true);


    Works great.

    Thanks for replying.

  4. #4
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: Controlling TABSTOP

    Tabstop is not an event, it's a property that, when set to false, will stop the control from reacting on the TAB key. I'm not sure why you would ever need to handle an event to complete this task
    It's not a bug, it's a feature!

  5. #5
    Join Date
    May 2009
    Posts
    34

    Re: Controlling TABSTOP

    It would appear that I was looking in the wrong place. When I went back to find the property, it was there. Brain fart I suppose.

    Thank you.

  6. #6
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Controlling TABSTOP

    Don't ignore the documentation because it doesn't (seem to) appear in the property list of your WISYWIG editor...
    If you liked my post go ahead and give me an upvote so that my epee.... ahem, reputation will grow.

    Yes; I have a blog too - http://the-angry-gorilla.com/

  7. #7
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Controlling TABSTOP

    Mark your thread Resolved please.

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