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. Grouping Controls using Group Box control

Grouping Controls using Group Box control

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studio
4 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.
  • K Offline
    K Offline
    Kiran Pinjala
    wrote on last edited by
    #1

    I have created a SDI application with CFormView in VS 2005, vc++, MFC. I placed listctrl, a group box, and a couple of buttons and textboxes in the group box. I am setting the list ctrl and group box posisions at runtime using SetWindowPos(). The list control and the group box sets as per my x,y values. But the control which i have palced in the group box are not set with the group box. They are there, where i have placed them statically. I want all the control placed in the group box to be set as i change the pos of the group box. Is it possible. If yes where am i doing wrong. Thank you.

    Saadhinchaali

    C 1 Reply Last reply
    0
    • K Kiran Pinjala

      I have created a SDI application with CFormView in VS 2005, vc++, MFC. I placed listctrl, a group box, and a couple of buttons and textboxes in the group box. I am setting the list ctrl and group box posisions at runtime using SetWindowPos(). The list control and the group box sets as per my x,y values. But the control which i have palced in the group box are not set with the group box. They are there, where i have placed them statically. I want all the control placed in the group box to be set as i change the pos of the group box. Is it possible. If yes where am i doing wrong. Thank you.

      Saadhinchaali

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      A groupbox is just a control like any other (with a big hole in it). Just because you place controls inside of it in the dialog editor it won't be the parent of those controls. So as far as i know you can't move the controls visibly inside the gorup box by just moving the group box itself, you have to move the controls individually inside the group box. You could try doing 4 things i think: 1. Move the controls individually - not too nice but works 2. Put the controls which are inside of the groupbox on some custom-made panel and move that one around, so you only have to move the groupbox and the panel representing its inside. - a bit complicated, not too nice, but works 3. Put the groupbox and the controls visually inside it onto a panel (like a child dialog for exmaple) and move that one around - a bit less complicated than 2. but still not nice 4. Write some helper class that walks thorough the controls which are inside the gorup box and moves them around, maybe a class inherited from the groupbox class. - I'd chose this one, you are still moving around the controls individually but you get a reusable way to do so. You would need for example an array into which you'd place the controls that need to be moved simulteniously, you could also make a method for it that collects the controls inside the group box by checking their positions. I hope this all helps, good luck.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. <

      K 1 Reply Last reply
      0
      • C Code o mat

        A groupbox is just a control like any other (with a big hole in it). Just because you place controls inside of it in the dialog editor it won't be the parent of those controls. So as far as i know you can't move the controls visibly inside the gorup box by just moving the group box itself, you have to move the controls individually inside the group box. You could try doing 4 things i think: 1. Move the controls individually - not too nice but works 2. Put the controls which are inside of the groupbox on some custom-made panel and move that one around, so you only have to move the groupbox and the panel representing its inside. - a bit complicated, not too nice, but works 3. Put the groupbox and the controls visually inside it onto a panel (like a child dialog for exmaple) and move that one around - a bit less complicated than 2. but still not nice 4. Write some helper class that walks thorough the controls which are inside the gorup box and moves them around, maybe a class inherited from the groupbox class. - I'd chose this one, you are still moving around the controls individually but you get a reusable way to do so. You would need for example an array into which you'd place the controls that need to be moved simulteniously, you could also make a method for it that collects the controls inside the group box by checking their positions. I hope this all helps, good luck.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. <

        K Offline
        K Offline
        Kiran Pinjala
        wrote on last edited by
        #3

        Thank you. I just tried to place a tab control and put some controls on it. Even the tab control is not controling the controls. When i am moving the tabcontrol the controls placed on it are not moving. I tried cut paste on tab control also. Can u help me in this!

        Saadhinchaali

        C 1 Reply Last reply
        0
        • K Kiran Pinjala

          Thank you. I just tried to place a tab control and put some controls on it. Even the tab control is not controling the controls. When i am moving the tabcontrol the controls placed on it are not moving. I tried cut paste on tab control also. Can u help me in this!

          Saadhinchaali

          C Offline
          C Offline
          Code o mat
          wrote on last edited by
          #4

          The tab control is the same as the group box regarding this issue. If you want to change tabs you will either have to write yourself your own tabpage-changing mechanism or look for one, i am sure there are such already written and useable solutions for that here (or just use google).

          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

          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