how to select on the valid listview items?

This is a discussion on how to select on the valid listview items? within the C++ Programming forums, part of the General Programming Boards category; Hi guys,
Can you please help me with my listview items. I want to know that when a user select ...

how to select on the valid listview items?

Hi guys,

Can you please help me with my listview items. I want to know that when a user select the items on the listview to tick and untick on the checkboxes while a user do not select on the other listview items, how do the program suppose to know which listview items that a user have selected after tick and untick on the checkboxes?

if it's a nullable bool, then "== true" is a perfectly valid expression, because System::Nullable<bool> doesn't implicitly convert to bool, but it does have an overloaded equality operator.

What's your point? The code in question is pseudo-code, we obviously aren't talking about nullables or tribools or whatever. My point still stands, using "== true" in a boolean expression is fundamentally wrong. You found an exception to this rule, have some cake.

Writing "== true" is basically just another way of saying "i don't know how boolean-expressions work".

So what, it comes down to opinion. You don't think it's reasonable because there is an equivalent short hand available, it's nothing wrong with explicitly typing it out. The short hand buys you nothing.

So what, it comes down to opinion. You don't think it's reasonable because there is an equivalent short hand available, it's nothing wrong with explicitly typing it out. The short hand buys you nothing.

Wrong, my version is not shorthand for anything. There is something wrong with writing out " == true", if your expression evaluates to true, you don't then have to compare it to true, that's not the right way, that's stupid.

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !

Wrong, my version is not shorthand for anything. There is something wrong with writing out " == true", if your expression evaluates to true, you don't then have to compare it to true, that's not the right way, that's stupid.

It's stupid to be confrontational. What am I doing? You say it's fundamentally wrong, which would mean that it's contrary to the standard, will result in undefined behavior, compile or runtime error.

This really has nothing to do with C or C++ or any standard, this transcends languages. This is a matter of a gross misunderstanding of boolean logic.

It doesn't but that is not what we are discussing here. "true == true" is known to be true, "x == true" can be true or false depending on the value of x.

checkeditems->Selected is evaluated first, to either true or false. This is all you need to do. The OP then does a further comparison with true, which is completely redundant. After checkeditems->Selected is evaluated, the expression essentially becomes "true == true" or "false == true".

This is not a matter of what I do or don't do. It's you trying to make this into an error, it's not. It's a valid expression.

There are many valid expressions in C and C++ that should be avoided. This code isn't wrong, and it will do what it was meant to, but it certainly won't make for very good code.

It's no different than this:

Code:

if( x > 5 == true)

So i will repeat the question that you so elegantly dodged, do you consider the above snippet of code to be good? If no, then you cannot logically find the code in the OP to be any better, if yes then you are beyond reasoning.

So i will repeat the question that you so elegantly dodged, do you consider the above snippet of code to be good? If no, then you cannot logically find the code in the OP to be any better, if yes then you are beyond reasoning.

It's a constructed scenario, I would not write something like that, ever. If you compare a bool, you can explicitly write out "== true" or "== false" if you think that makes the code more readable. It's a matter of style..

Should you use a or b? I don't care because it does not matter, it comes down to style. You clearly have a very strong opinion about it, to the point that you are trying to convince us that it's wrong

It's a constructed scenario, I would not write something like that, ever. If you compare a bool, you can explicitly write out "== true" or "== false" if you think that makes the code more readable. It's a matter of style..

Should you use a or b? I don't care because it does not matter, it comes down to style. You clearly have a very strong opinion about it, to the point that you are trying to convince us that it's wrong

That is my only issue here, because that is a fallacy.

Redundant code is wrong. I could throw in an i++; i--; in my code, and it would compile, and it would conform to the standard, and it would work. But it would be wrong. And i would get called out about it if i put up any such code on this board.
There must be a dozen beginning programmers in here every week, that get told to fix their indentation because it's wrong.
I could use goto's as a replacement for loops, and it would be wrong.
I could use preprocessor macros extensively in lieu of proper C++ control stuctures, and it would be wrong.

...it does not matter, it comes down to style.

Extremely poor style is wrong. Throwing in an extra comparison left and right for readabilities sake probably means your naming convention is off.