Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Does WS_TABSTOP works on CWnd classes?

Does WS_TABSTOP works on CWnd classes?

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Miguel Lopes
    wrote on last edited by
    #1

    Hi. I have a bunch of controls dynamically created in a CWnd and i want to jump between them with the TAB. Just adding WS_TABSTOP to the dwstyle isnt working. Is it because i have to be in a CDialog or CFormView (parent)class? If so, is the best solution to emulate it by tracking the TAB button and using CWnd::GetNextDlgTabItem ? Other related question: how do i set the tab order in dynamic created controls? Creation order? Thanks in advance!

    C 1 Reply Last reply
    0
    • M Miguel Lopes

      Hi. I have a bunch of controls dynamically created in a CWnd and i want to jump between them with the TAB. Just adding WS_TABSTOP to the dwstyle isnt working. Is it because i have to be in a CDialog or CFormView (parent)class? If so, is the best solution to emulate it by tracking the TAB button and using CWnd::GetNextDlgTabItem ? Other related question: how do i set the tab order in dynamic created controls? Creation order? Thanks in advance!

      C Offline
      C Offline
      Chris Richardson
      wrote on last edited by
      #2

      I think it should work with a CWnd. To set the tab order dynamically, call SetWindowPos, like this

      pWindowBefore->SetWindowPos( pWindowAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );

      where you want pWindowAfter to be the control that gets tabbed to when pWindowBefore has the focus and the user hits Tab. Creation order should set the initial tab order, so if you create your controls in the order that they should be tabbed between, you should be OK. If you are using a fully custom control, there's some wierd issues with focus (like needing to manually call SetFocus when you get a WM_LBUTTONDOWN). I can't really remember the specifics, but mess around with the SetFocus, and see where it takes you. Chris Richardson C/C++ Include Finder[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups