DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Tabbing within a user control

  1. #1
    Jamie Harsevoort Guest

    Tabbing within a user control


    I am writing an ActiveX control that is completely user-drawn. The control
    has several "focus areas" that the user needs to be able to tab between.
    I originally put code in the KeyDown event to handle the change in focus,
    however this only works if the control is the only control on a form. Once
    other controls are placed on the form, pressing the Tab key causes the focus
    to move to the next control on the form.

    Is there any way to trap the Tab press before the focus moves off of the
    control? Should I be trapping the WM_KEYDOWN event?

    Thanks,

    Jamie

  2. #2
    Jim Deutch Guest

    Re: Tabbing within a user control

    I "solved" this the easy way: use the Tab key to navigate between controls
    on the form and the arrow keys to navigate between "focus areas" on the
    usercontrol...

    Jim Deutch

    Jamie Harsevoort wrote in message <392009b3$1@news.devx.com>...
    >
    >I am writing an ActiveX control that is completely user-drawn. The control
    >has several "focus areas" that the user needs to be able to tab between.
    >I originally put code in the KeyDown event to handle the change in focus,
    >however this only works if the control is the only control on a form. Once
    >other controls are placed on the form, pressing the Tab key causes the

    focus
    >to move to the next control on the form.
    >
    >Is there any way to trap the Tab press before the focus moves off of the
    >control? Should I be trapping the WM_KEYDOWN event?
    >
    >Thanks,
    >
    >Jamie




  3. #3
    Jamie Harsevoort Guest

    Re: Tabbing within a user control


    I thought I had solved it that way too. Unfortunately the end users don't
    agree


    "Jim Deutch" <103134.3516@compuserve.com> wrote:
    >I "solved" this the easy way: use the Tab key to navigate between controls
    >on the form and the arrow keys to navigate between "focus areas" on the
    >usercontrol...
    >
    >Jim Deutch



  4. #4
    Audie F. Thomas Guest

    Re: Tabbing within a user control

    Another way to solve this is:
    1. Place another control on your user control (a command button works
    well)
    2. Set the position of this control so that it is not visible to the user.
    3. Use the GetFocus event of this control to catch the Tab and Set the
    "Focus"
    as desired.
    You may need two new controls to catch both Tab and Shift Tab.

    --
    Regards,
    Audie F. Thomas
    Audie Technology, Inc.
    sales@audietech.com



  5. #5
    Neal Andrews Guest

    Re: Tabbing within a user control

    Hi There

    I am afraid as you have found out it is not all that simple.

    There are two possible ways to do this the first is to use a system wide
    keyboard hook the second and better way is for your control to implement
    IOleInPlaceActiveObject and override vb's version. Have a look at Paul R.
    Wilde's excellent vbaCom library on http://www.vbaccelerator.com/ for the
    source code with examples of how to do this.

    Just had a look on http://www.vbaccelerator.com/ site. Go to the TBL section
    any look for the links under "Ole Guild and Interface Definitions" and you
    should see a separate example program that does exactly what you want.

    Regards
    Neal



    "Audie F. Thomas" <audietech@erols.com> wrote in message
    news:3923266f@news.devx.com...
    > Another way to solve this is:
    > 1. Place another control on your user control (a command button works
    > well)
    > 2. Set the position of this control so that it is not visible to the

    user.
    > 3. Use the GetFocus event of this control to catch the Tab and Set the
    > "Focus"
    > as desired.
    > You may need two new controls to catch both Tab and Shift Tab.
    >
    > --
    > Regards,
    > Audie F. Thomas
    > Audie Technology, Inc.
    > sales@audietech.com
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center