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. Around 500 controls in a Dialog

Around 500 controls in a Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 8 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.
  • A Offline
    A Offline
    AnsGe
    wrote on last edited by
    #1

    Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

    T M K S T 5 Replies Last reply
    0
    • A AnsGe

      Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      you can, but you won't be able to place all of them at design, because the editor is limiting you. add the additionnal controls it at runtime...


      TOXCCT >>> GEII power
      [toxcct][VisualCalc 2.20][VisualCalc 3.0]

      1 Reply Last reply
      0
      • A AnsGe

        Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        AnsGe wrote:

        500 controls simultaneously on a single Dialog?

        OMG, I hope that I will never use your application. but on a more serious note, explain what you want to do, maybe there are better ways that we could suggest.


        Maximilien Lincourt Your Head A Splode - Strong Bad

        R 1 Reply Last reply
        0
        • A AnsGe

          Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

          K Offline
          K Offline
          khan
          wrote on last edited by
          #4

          I think you could: 1- Create the controls dynamically with pre-defined ID's. 2- Create a few child dialogs, each having a couple hundred controls. 3- Edit the .RC file, and add them manually. 4- Some other way. Why? this is this.

          S 1 Reply Last reply
          0
          • A AnsGe

            Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

            S Offline
            S Offline
            Sheng Jiang
            wrote on last edited by
            #5

            go windowless and draw the controls yourself My blogs: http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng http://bloglines.com/public/jiangsheng Command what is yours Conquer what is not ---Kane

            1 Reply Last reply
            0
            • M Maximilien

              AnsGe wrote:

              500 controls simultaneously on a single Dialog?

              OMG, I hope that I will never use your application. but on a more serious note, explain what you want to do, maybe there are better ways that we could suggest.


              Maximilien Lincourt Your Head A Splode - Strong Bad

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              Maximilien wrote:

              OMG, I hope that I will never use your application.

              LMAO :D You have an apple and me too. We exchange those and We have an apple each. You have an idea and me too. We exchange those and We have two ideas each.

              1 Reply Last reply
              0
              • A AnsGe

                Hi, how can i place around 500 controls simultaneously on a single Dialog? Any idea? Thanks in advance. Anish.

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                AnsGe wrote:

                how can i place around 500 controls simultaneously on a single Dialog?

                IMHO, Putting 500 control on single dialog is not part of good design, better try breaking them into diffrent property sheets! if you still insist on putting 500 control on single dialog... htne dynamically generating control will better option

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                1 Reply Last reply
                0
                • K khan

                  I think you could: 1- Create the controls dynamically with pre-defined ID's. 2- Create a few child dialogs, each having a couple hundred controls. 3- Edit the .RC file, and add them manually. 4- Some other way. Why? this is this.

                  S Offline
                  S Offline
                  Shraddhan
                  wrote on last edited by
                  #8

                  Here's a fragment of code from a dialog I wrote earlier: Declare some controls CStatic m_txtLabelIn [ 500 ]; And create them with any arbitrary size for now for (i = 0; i < sizeof(m_txtLabelIn) / sizeof(m_txtLabelIn[0]); i++) m_txtLabelIn[i].Create("", SS_LEFTNOWORDWRAP, rect, this); and then do a SetWindowPosition on each one to put them where you want them. (You ARE sure they will all fit the space available?) Shraddhan

                  K 1 Reply Last reply
                  0
                  • S Shraddhan

                    Here's a fragment of code from a dialog I wrote earlier: Declare some controls CStatic m_txtLabelIn [ 500 ]; And create them with any arbitrary size for now for (i = 0; i < sizeof(m_txtLabelIn) / sizeof(m_txtLabelIn[0]); i++) m_txtLabelIn[i].Create("", SS_LEFTNOWORDWRAP, rect, this); and then do a SetWindowPosition on each one to put them where you want them. (You ARE sure they will all fit the space available?) Shraddhan

                    K Offline
                    K Offline
                    khan
                    wrote on last edited by
                    #9

                    No I am not sure that they all will fit on one dialog. If you are using it maximized with screen resolutions 1024 x 768, then maybe it is possible. Actually it all depends on the size of individual controls, and what you choose to put in them, like text, icons, images etc. Suggestion: You should rather use a property sheet with a few property pages in it. That way, you can put fewer controls on each page, and it would be easier to create and use, and would fit in a smaller screen area. Now about your code: CStatic m_Static[500];// is not a very good idea. //You should rather use: CStatic* m_pStatic; m_pStatic = new CStatic[500];// etc However, I strongly recommend using property sheet and pages. this is this.

                    S 1 Reply Last reply
                    0
                    • K khan

                      No I am not sure that they all will fit on one dialog. If you are using it maximized with screen resolutions 1024 x 768, then maybe it is possible. Actually it all depends on the size of individual controls, and what you choose to put in them, like text, icons, images etc. Suggestion: You should rather use a property sheet with a few property pages in it. That way, you can put fewer controls on each page, and it would be easier to create and use, and would fit in a smaller screen area. Now about your code: CStatic m_Static[500];// is not a very good idea. //You should rather use: CStatic* m_pStatic; m_pStatic = new CStatic[500];// etc However, I strongly recommend using property sheet and pages. this is this.

                      S Offline
                      S Offline
                      Shraddhan
                      wrote on last edited by
                      #10

                      Whether or not 500 controls will fit on a mere 1024 x 768 display surely depends on how big they are and what they do. I don't know what the original questioner had in mind. I know that I have a dialog that will hold up to 120 CEdit controls and about a dozen others, and the property sheet technique will not help as they all need to be visible at the same time. However, as my screen resolution is a pleasant 2304 x 864, this is perfectly OK. I note with interest your comment on my code smippet that CStatic m_Static[500]; is not a very good idea. Please tell me why not? As the array is a member of a class (a CDialog), I don't need to worry about deleting it. So in what way is using new better? Shraddhan

                      K 1 Reply Last reply
                      0
                      • S Shraddhan

                        Whether or not 500 controls will fit on a mere 1024 x 768 display surely depends on how big they are and what they do. I don't know what the original questioner had in mind. I know that I have a dialog that will hold up to 120 CEdit controls and about a dozen others, and the property sheet technique will not help as they all need to be visible at the same time. However, as my screen resolution is a pleasant 2304 x 864, this is perfectly OK. I note with interest your comment on my code smippet that CStatic m_Static[500]; is not a very good idea. Please tell me why not? As the array is a member of a class (a CDialog), I don't need to worry about deleting it. So in what way is using new better? Shraddhan

                        K Offline
                        K Offline
                        khan
                        wrote on last edited by
                        #11

                        Statically creating so many controls will take more memory out of the stack space for the thread. If you have a large amount of code with that, then the stack might even get corrupted. I tried once with about 16 objects of CView, with a lot of other code and controls, and the program simply crashed on some machines without showing any error at all. So, it would be wiser to allocate so many controls on the heap. this is this.

                        S 1 Reply Last reply
                        0
                        • K khan

                          Statically creating so many controls will take more memory out of the stack space for the thread. If you have a large amount of code with that, then the stack might even get corrupted. I tried once with about 16 objects of CView, with a lot of other code and controls, and the program simply crashed on some machines without showing any error at all. So, it would be wiser to allocate so many controls on the heap. this is this.

                          S Offline
                          S Offline
                          Shraddhan
                          wrote on last edited by
                          #12

                          khan++ wrote:

                          then the stack might even get corrupted

                          Didn't I say that the array of CEdit controls was a member of the window class, a CDialog? I assumed that the controls would be allocated memory anywhere but the heap, and being created by the class's constructor, if this failed the dialog would surely not open. Or am I missing something here? Shraddhan

                          K 1 Reply Last reply
                          0
                          • S Shraddhan

                            khan++ wrote:

                            then the stack might even get corrupted

                            Didn't I say that the array of CEdit controls was a member of the window class, a CDialog? I assumed that the controls would be allocated memory anywhere but the heap, and being created by the class's constructor, if this failed the dialog would surely not open. Or am I missing something here? Shraddhan

                            K Offline
                            K Offline
                            khan
                            wrote on last edited by
                            #13

                            Well, if it works, then you don't need to worry. What I actually meant was that when you have lots of controls and lots of code, then it is safer to allocate them using new instead of statically. But if it works, then who cares where and how they are created. ;) this is this.

                            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