WinApp: Navigate TabPage using custom keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mecena
    New Member
    • Apr 2007
    • 31

    WinApp: Navigate TabPage using custom keys

    Hi!

    I'm using arrow keys to navigate thru controls and I want my tab control to
    implement that feature too, so when tabpage gets entered (focus is on the
    header) DOWN key should focus on first tabpage control. Now, how can it
    be achieved? I used to navigate using my utility classes, but recently
    discovered that SendKeys.Send(" {TAB}") works fine too on most controls. Can
    I use it on tab too?

    thnx,
    M.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Originally posted by Mecena
    Hi!

    I'm using arrow keys to navigate thru controls and I want my tab control to
    implement that feature too, so when tabpage gets entered (focus is on the
    header) DOWN key should focus on first tabpage control. Now, how can it
    be achieved? I used to navigate using my utility classes, but recently
    discovered that SendKeys.Send(" {TAB}") works fine too on most controls. Can
    I use it on tab too?

    thnx,
    M.
    Hi,
    Glad to see someone in the same mess as me. (using custom navigation keys)
    Well...If you use the {TAB} with the tabControl focused, it will go onto the next control (which will obviously not be the next tab page)
    Tab pages are scrolled using the arrow keys (left and right) so you would have to send the arrow keys, but then someone has to make the decesion on which keys will those be, or commit to selecting tab pages using the mouse.

    However, you could create chortcut keys (Alt+1 for tabpage1, and so on). This may be easier

    I convinced them to use the mouse for tab selection , So i havent had the need to implement that as yet.

    Comment

    • Mecena
      New Member
      • Apr 2007
      • 31

      #3
      :) Hi!
      Selecting tabpages is not the issue, selecting controls is. If my focus is on the tabpage header, {TAB} gives me the first control, which is fine. But when i focus on the first control, things get messy because i'm handling the tabcontrol's KeyDown which i cannot use since i'm handling KeyDown in my controls already. So what i need is some kind of a check to see if the tabpage header is actually focused, not the whole tabpage. Or some other idea?
      M.

      Originally posted by Shashi Sadasivan
      Hi,
      Glad to see someone in the same mess as me. (using custom navigation keys)
      Well...If you use the {TAB} with the tabControl focused, it will go onto the next control (which will obviously not be the next tab page)
      Tab pages are scrolled using the arrow keys (left and right) so you would have to send the arrow keys, but then someone has to make the decesion on which keys will those be, or commit to selecting tab pages using the mouse.

      However, you could create chortcut keys (Alt+1 for tabpage1, and so on). This may be easier

      I convinced them to use the mouse for tab selection , So i havent had the need to implement that as yet.

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Originally posted by Mecena
        :) Hi!
        Selecting tabpages is not the issue, selecting controls is. If my focus is on the tabpage header, {TAB} gives me the first control, which is fine. But when i focus on the first control, things get messy because i'm handling the tabcontrol's KeyDown which i cannot use since i'm handling KeyDown in my controls already. So what i need is some kind of a check to see if the tabpage header is actually focused, not the whole tabpage. Or some other idea?
        M.
        I thought you answered yourself there.
        You need to check if the tabcontrol is selected n the tabcontrols keydown event

        So in the tabControls keydown event check if the tabcontrol is focused, if yes then continue, else dont handle the keys

        Comment

        • Mecena
          New Member
          • Apr 2007
          • 31

          #5
          wow. I thought I tried that one, but obviously haven't:) thanx, that was an eye opener right there:)


          Originally posted by Shashi Sadasivan
          I thought you answered yourself there.
          You need to check if the tabcontrol is selected n the tabcontrols keydown event

          So in the tabControls keydown event check if the tabcontrol is focused, if yes then continue, else dont handle the keys

          Comment

          Working...