|
Starting with IE3, list controls support check boxes natively. Eran Yariv's article Adding Checkboxes to a list control provides more info on the subect. If you already managed to have list controls without MFC support, adding the check boxes thing shouldn't be difficult.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi all,
Thanks for ur prompt replies.
I experimented with checkboxes by using button class for window creation and SendMessage() calls.Since I am planning to write a generic code for both WinNT and WinCE,I wanted to know whether such a thing can be done without having to write my own class implementaion for checkboxes.
What restrictions does use of MFC place when I am trying to write a generic platform idependent code?
TIA,
Vivek
|
|
|
|
|
I'm afraid I don't quite understand the first part of your post. With respect to using a unified MFC code for NT and CE platforms, it is certainly possible and the burdens imposed by MFC here are usually just reflections of the intrinsic differences between the APIs of both systems. If you plan to write code targeted for CE and NT, remember that CE is Unicode-only, which means you're forced to use that pesky _T and TCHAR macros and the versions of the C run-time library string functions as declared in <tchar.h> .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I know this is a bit of a dumb question; but does C++ have an XOR operator
If not, can anyone remember enough boolean algebra to create an XOR out of AND, OR and NOT?
I should know, I only studied this stuff about 2 years ago, but heh, why not Harness The Power Of The Web (tm)
TIA,
Pete
|
|
|
|
|
Bitwise-exlcusive OR ^
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Thanks, but I need a non-bitwise operator, i.e. && || etc.
BTW, that was an impressive response time (3 minutes)
|
|
|
|
|
^ is the bitwise XOR operator, whereas ^^ is the logical XOR operator. If you don't know the difference, feel free to ask
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
there is no logical XOR. at least not in VC6
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
Oh yes, there ain't such an operator! I guess I just extended the obvious analogy from & and && without thinking it too much. What strikes me is that all these years have passed without noticing before Thanks for pointing out. My apologies to all.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i wouldn't have known, if i wasn't looking for the exact thing last night. didn't find it, of course.
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
I found out that while answering a question to a VB programmer. He asked about XOR in C++, and I thought: "What a stupid question!", but I found out it was not that stupid after all.
I vote pro drink
|
|
|
|
|
That's what I like about answering questions here -- you have to relearn the stuff in order to give accurate answers, even when you get to the basics.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
VC++ spews at ^^
if( aCurrCPA[ref_c] ^^ aCurrCPA[temp_c] )
produces this error
D:\Pete\Capture\vss\Tracker.cpp(208) : error C2059: syntax error : '^'
is it non-standard C?
|
|
|
|
|
GEEK OUT ALERT!!!!
XOR via AND and OR:
(a & !b) | (b & !a)
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Shouldn't it be
(a & ~b) | (b & ~a) not to mix logical and bitwise operators?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
so for a logical operator this should work
(bool1 && !bool2) || (bool2 && !bool1)
right?
Thanks for the super-fast answers, BTW
|
|
|
|
|
In fact, if we want get all clever about it we could use
#define XOR( a, b ) ((a) && !(b)) || ((b) && !(a))
|
|
|
|
|
template <class T>
T XOR(const T val1, const T val2)
{
return ( ((val1)&(~val2)) | ((~val1)&(val2)) );
}
Hope that I am correct!
"Dirty hands lead to important discovery..." - Thomas Edison
|
|
|
|
|
For this to work, the class used has to implement the operators &,| and ~.
Otherwise you get comile errors (right?)
Good Luck,
Bill
|
|
|
|
|
This is more efficient (maximum number of evaluations is 2, in the previous formula it is 4)
bool1?!bool2:bool2
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
nice
|
|
|
|
|
But that isn't done with AND and ORs.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
So much stuff from such a little subject
Another advantage of a?!b:b with respect to (a&&!b)||(!a&&b) is that the former does not have the "double evaluation" problem of the latter, which is important if one plans to make a macro out of it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
My version works better for circuits
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
If you're doing TTL (which means only NANDs and negators), I think this is the way to go (my electronics are a little rusty, nevertheless, I could be wrong)
(a NAND !b) NAND (!a NAND b)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|