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. Custom tree control

Custom tree control

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestion
3 Posts 3 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
    Marissa182
    wrote on last edited by
    #1

    i have created a custom tree control and created a group box to contain its location within in my dialog here is the code GetDlgItem(IDC_ZONETREE_FRAME)->GetWindowRect(frameRect); zone_tree.Create(WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS|TVS_HASBUTTONS , frameRect, this, IDC_ZONETREE); however when i run the program the tree control is like an inch below the group box is there something wrong with my code or whats the deal here ?

    H M 2 Replies Last reply
    0
    • M Marissa182

      i have created a custom tree control and created a group box to contain its location within in my dialog here is the code GetDlgItem(IDC_ZONETREE_FRAME)->GetWindowRect(frameRect); zone_tree.Create(WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS|TVS_HASBUTTONS , frameRect, this, IDC_ZONETREE); however when i run the program the tree control is like an inch below the group box is there something wrong with my code or whats the deal here ?

      H Offline
      H Offline
      HPSI
      wrote on last edited by
      #2

      Try this:

      GetDlgItem(IDC\_ZONETREE\_FRAME)->GetWindowRect(frameRect);
      ScreenToClient(&frameRect);
      zone\_tree.Create(WS\_VISIBLE|TVS\_HASLINES|TVS\_LINESATROOT|TVS\_SHOWSELALWAYS|TVS\_HASBUTTONS, 
          frameRect, this, IDC\_ZONETREE);
      

      HPS HwndSpy - GUI developer's aid to visually locate and inspect windows. For the month of August only, use coupon code CP-81239 for 30% off.

      1 Reply Last reply
      0
      • M Marissa182

        i have created a custom tree control and created a group box to contain its location within in my dialog here is the code GetDlgItem(IDC_ZONETREE_FRAME)->GetWindowRect(frameRect); zone_tree.Create(WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS|TVS_HASBUTTONS , frameRect, this, IDC_ZONETREE); however when i run the program the tree control is like an inch below the group box is there something wrong with my code or whats the deal here ?

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        The previous answer is right, but the reason you need the ScreenToClient() call is that GetWindowRect() returns the coords relative to the screen, but Create() takes coords relative to the dialog's client area. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

        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