Saturday, April 23, 2011

CCheck constructor

CCheck(bool Checked,const char* Format, const char* Text, int Row, int Col, int Width, bool IsRadio = false);
 Passes the Row, Col, Width and "1" to row, col, width and height arguments of CField and directly initializes* _Label with Text, 0, 4, and (Width-4) for Str, Row, Col and Len, arguments of CLabel's Constructor.
After I spent some time, I figured out that
": CField(Row,Col,Width,1) : _Label(Text,0,4,Width-4), _flag(Checked), _radio(IsRadio)" didn't work.
Only ": CField(Row,Col,Width,1), _Label(Text,0,4,Width-4), _flag(Checked), _radio(IsRadio)" worked.

#pragma once and include guards

Both work the same way. "#pragma once" seems simpler and less lines to type.
But pragmas are machine- or operating system-specific by definition, and are usually different for every compiler. So if the code need to be portable, use the include guards.

Thursday, January 13, 2011