Microsoft Foundation Classes (MFC) library provides CButton which, according to MSDN, can be used for creating a check box, a radio button, and a pushbutton.
There are two events CButton supports: (i) ON_BN_CLICKED (single click), (ii) ON_BN_DOUBLECLICKED (double click). Let’s assume you provide a meaningful implementation for a single click and do nothing in the event handler for the double click (empty method’s body). The result if a single click is obvious, but what will happen if user double clicks the check box (or the other CButton representation)? There are two possible answers (assuming the check box was unchecked initially):
- Check box will be checked, and then unchecked – a simulation of a double (single) click
- Check box will be checked only – one action takes place now
Continue reading ‘MFC: CButton and how ON_BN_DOUBLECLICKED message map works’
Published on
November 19, 2009 in
c++.
Tags: c++.
Initializer list in C++ looks like in the example below (see constructor od D class):
class B {
public:
B() { }
};
class D : public B {
public:
int x;
int y;
D(int _x , int _y) : x(_x) , y(_y +1) { }
};
Continue reading ‘Initializer list and initializing derived class members’
After several years of working with Java, C#, SQL and web technologies in general, there’s some time to use the other languages. Among others I’ll be writing some C++ code from time to time now.
I used C (and alittle bit of C++) when I was a student but that were all small projects and it was years ago. Now, it’s obvious I need to catch up with C/C++. I happened to get C++: The Complete Reference by Herbert Schildt. The word reference implies there’s probably no point in reading this book from title-page to colophon; there’s a lot of reference data like the standard function library. However, what I really liked about this book is it gives a quick introduction to most important aspects of C/C++ (e.g. pointers, classes, references, overloading, templates), of course with obvious and numerous code examples.
Recommended. It’s worth keeping this book nearby while working with C++.