Download source files - 17 KbDownload demo project - 7 Kb
Recently at work, I was asked for help trying to put a
button on top of a static box, and decided instead to
write a class that encapsulated the behaviour desired. I
promptly did nothing about it, until last night my crying
son left me no chances of sleep and the idea came back to
me in my semi-exausted stupor.
Basically the idea is this: if you drag out a static
box to bound some controls, you can go into the header
file and change the variable type to
automatically you will have a check box in the top left
corner of the static, and checking/unchecking the box
will enable/disable any control inside the box that has a
TAB stop ( well, almost, read the screen of the demo for
some known issues ). When I say automatically, don't
forget you need to call the Init() method in your
OnInitDialog in order to set it all up.
If you want to get a bit more fancy, you can simply
add ID's of items you want to control, and only those
items will be effected. This allows you to both exclude
items within the box and also include items outside it.
It also means you don't need a TAB stop on each item in
the box. So it's probably the best way to go, but it
requires some more setting up and I always like the idea
of a class being able to take care of itself, as well as
being flexible, so both behaviours are presented for your
Here is a list of the methods exposed by
It's hopefully pretty self explanatory.
That's about all I have to say. Feel free to send suggestions/flames/FatBrain gift
vouchers to the above address as you see fit.