<!-- Download Links -->
Download source files - 17 Kb
Download demo project - 7 Kb
<!-- Article image -->
<!-- Main HTML starts here -->
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.
Programming computers ( self taught ) since about 1984 when I bought my first Apple ][. Was working on a GUI library to interface Win32 to Python, and writing graphics filters in my spare time, and then building n-tiered apps using asp, atl and asp.net in my job at Dytech. After 4 years there, I've started working from home, at first for Code Project and now for a vet telemedicine company. I owned part of a company that sells client education software in the vet market, but we sold that and I worked for the owners for five years before leaving to get away from the travel, and spend more time with my family. I now work for a company here in Hobart, doing all sorts of Microsoft based stuff in C++ and C#, with a lot of T-SQL in the mix.