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. How to set focus to dialog controls

How to set focus to dialog controls

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
2 Posts 2 Posters 4 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.
  • C Offline
    C Offline
    Chris Vischer
    wrote on last edited by
    #1

    Hi everybody, i have a dialog with a treectrl and several other controls like combo and listboxes, and i want that if you doubleclick a treenode/item that his related control in the dialog gets the focus. The treenode stores a pointer to his related control. I tried pControl->SetFocus() in the OnDblClk handler but it doesn't work. Need help. TIA, Chris

    U 1 Reply Last reply
    0
    • C Chris Vischer

      Hi everybody, i have a dialog with a treectrl and several other controls like combo and listboxes, and i want that if you doubleclick a treenode/item that his related control in the dialog gets the focus. The treenode stores a pointer to his related control. I tried pControl->SetFocus() in the OnDblClk handler but it doesn't work. Need help. TIA, Chris

      U Offline
      U Offline
      User 4487
      wrote on last edited by
      #2

      Hi Chris, Its' not clear to understand your need. What I guess was you want to set a focus to child control. Get a window handle of that control using pControl->GetSafeHwnd() which will return HWND, Using this handle get a pointer ot that window using FromHandle(). Use this returned pointer to set the focus of that window. This should work. If not, feel free to mail me. ================== The original message was: Hi everybody,
      i have a dialog with a treectrl and several other controls like combo and listboxes,
      and i want that if you doubleclick a treenode/item that his related control in the
      dialog gets the focus. The treenode stores a pointer to his related control.
      I tried pControl->SetFocus() in the OnDblClk handler but it doesn't work.

      Need help.

      TIA, Chris

      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