Click to See Complete Forum and Search --> : More then 400 buttons in a dialog?
Wuppinger
April 25th, 1999, 10:12 AM
I've tried to generate a dialogbox with about 400 buttons, but it was not possible to generate more then about 200. If you want to copy more then the 200 in the resource editor, it was not possible! Is there a limitaion of controls in dialogbox or must I choose an other way to generate this 400 buttons?
Paul McKenzie
April 25th, 1999, 11:24 PM
What? **400** buttons??!! Maybe you should rethink the design.
Anyway, you can edit the resource (.RC) file yourself. There's no harm in doing this since it's only a text file. Then, you can cut / copy / paste as much as you want with your favorite text editor. This would be much easier than using the resource editor.
Regards,
Paul McKenzie
Wuppinger
April 26th, 1999, 01:36 AM
Thanks a lot for your reply!
You are right I've already done this to create the buttons and I've could see them in the resource editor. But when I want to call the SubClassDlgItem() funcion to Subclass the PushButton to a ownerdrawn ColorButton it causes an ASSERTION.
So I guess here must be a limitation of controls,
but I can't believe this. So I'am searching for the error I make. And I need the 400 buttons to display one of four states of 400 signals!
Best regards
Ralph Wuppinger
Paul McKenzie
April 26th, 1999, 03:15 AM
I'm not sure of the error, but I'm wondering whether you could have created a single control that has 400 redrawable areas. You would store all of the area coordinates in an array. Whenever a signal changes, you would just change the color of the particular area by calling Invalidate() on the dialog. It may take a little work, but I believe that it's much better than the 400 button solution.
I did something like this a while ago. There were four status lights that would either display gray, red, or green depending on certain conditions. I don't have the code handy, so I can't give you all the details of what I did.
A better example is the way a toolbar works. All of those bitmaps in the toolbar are not individual controls. The toolbar is one control with 8x16 bitmaps that are drawn and controlled programatically. This includes the way the disabled, enabled and pushed states are drawn.
Just a thought.
Regards,
Paul McKenzie
Wuppinger
April 26th, 1999, 04:03 AM
Again much thanks for your fast reply.
I've forgotten to say that the user should have the ability to click on the signal to test it.
So I hoped to create the application in a short time using buttons. But I aggree with you, that perhaps it is the better way to do it in the way like your suggestion is. But never the less I can't understand why Windows or VC++ makes troubles if you want to have 400 buttons!
Ok, in any way lot of thanks for your time and your thoughts.
With best regards
Ralph Wuppinger
Paul McKenzie
April 26th, 1999, 01:19 PM
Back in Win 3.x days, there was a limit on the number of child windows (255). According to the docs, this limit was eliminated with Win 95 and NT, but the limit may still exist in some other aspect.
The best way to test this is to write a small app that calls only the API routines to display a dialog with 400 "OK" buttons. If it displays, and the button presses don't give you a GPF, the problem is MFC. If it still doesn't work, it's a problem with Windows. I usually keep a stub Win32 API program that I fill in with anything I need to experiment with (such as displaying a dialog with 400 controls).
Regards,
Paul McKenzie
Gomez Addams
April 26th, 1999, 01:44 PM
This article : http://www.codeguru.com/gdi/colorapp1.shtml
has a color grid that might give you some tips to get started.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.