Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Max controls per dialog AND do large numbers of controls impact overall system

Posted on 2007-08-05
9
Medium Priority
?
169 Views
Last Modified: 2013-11-20
Today I doscovered, the hard way, that VC++ has a hard limitation of 255 controls per dialog.  Actually, I think this is the editor as opposed to the language or the OS.  Reviewing the topic here, I discovered a lot of opinions, and counter opinions about effects on system performance, use of resources, programming style, etc.

My dialog has, you guessed it, 255 controls on it, and a need for a few more.  I realize that this dialog begs for a grid control, and, it will get one eventually.  For now though, absent some overriding consideration, I'll stick to dialogs and normal controls.

Fully 150 of the controls are CText, 7 are CComboBoxes, a few are Group Boxes, there are a few buttons, and about 80 CEdits.  By the way, I can easily remove about 10-20 controls that aren't absolutely necessary, and complete the project.

My questions are:
   1.  Am I creating overall system performance issues.
   2.  If I am, is there a way to place text on a dialog without using a control.

I know that I can create CText, or for that matter, any other control on the fly, but I am only interested in this if it somehow helps with system performance.

Thanks, Rick
0
Comment
Question by:rickatseasoft
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:rickatseasoft
ID: 19634371
One thing that I could do is take a row of data that is currently in colums by virtue of aligning the CTexts, and use one long CText to do the work of 6.  The question is how would I align the data within the control.  In other words, instead of indivicual controls as in

CText      CText       CText          CText        CText

A single control that had tabs or something in it to align the test
XXXX      XXXX     XXXX     XXXX        XXXX

Thanks, Rick
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 19634662
>>Today I doscovered, the hard way, that VC++ has a hard limitation of 255 controls per dialog.

Note :
Only dialog box 'template' support a maximum of 255 controls.

But If you want to create more than 255 controls in a dialog box, you may add the controls dynamically from within the OnInitDialog() function. Here you can put any number within reason.

-MAHESH
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 19634685
So 255 is limitation of template ie resource editor.

But if you have so many controls on a dialog I will suggest you to rethink about your design. You may also use tabs CPropertyPage,CPropertySheet  etc,that way for each "screen" you could have multiple lines with one or two controls.

-MAHESH
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 45

Expert Comment

by:AndyAinscow
ID: 19634692
You can use the OnPaint to draw text into the DC (so no static/text controls would be required).

You could create child dialogs and place these onto the dialog (runtime creation).

Is the dialog usable with so many controls?  How about splitting it into a tabbed dialog (property sheet/pages) ?
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 19634711
As I said you may split your controls using tabs, CPropertyPage,CPropertySheet  etc,that way for each screen you have fewer controls comapred to previous.

You may also activate this tabs automatically if you need to redirect user to input specific data.

-MAHESH
0
 

Author Comment

by:rickatseasoft
ID: 19634904
Thanks To All!

I take it, from the answers, that there is NOT a resource problem nor is there a system performance problem.  Do a quick search on this topic here on ee, and you will find dire warnings of system crashes, etc. all caused by the large complicated dialog.  This was my biggest concern.

mahesh1402:  I am aware of the ability to create controls at runtime, but, I didn't want to do that if there would be some sort of system performance penalty.  

Andy:  Under normal cirumstances, I would agree with you about the complexity of the dialog.  In this case,  I believe that it is justified. Thank for the tip about OnPaint(), I'll consider how to use that.
 
I'll let this sit for a couple of days to see if anyone raises any legitimate performance/resource issues, but, barring that, I believe that these two answers will suffice.

Thanks again, This site is priceless,  Rick
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 19634973
@ mahesh - oops, sorry for repeating the tab/property sheet suggestion.
0
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 1000 total points
ID: 19634977
system/resource problem - probably not a worry.
User overload - I agree with mahesh, could be a problem
0
 
LVL 22

Assisted Solution

by:mahesh1402
mahesh1402 earned 1000 total points
ID: 19636393
>>A single control that had tabs or something in it to align the test

You may use functions like CDC::DrawTextEX() which support additional formatting parameters such as DRAWTEXTPARAMS with which can set custom values for tab space, etc in string for formatted drawing.

But probably you will not need that because if your controls are fixed and you know positions then you can easily put your text above that controls on fly with pre-known positions.

>>@ mahesh - oops, sorry for repeating the tab/property sheet suggestion.

No probs at all andy ! :)

-MAHESH
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question