Re: Set the CheckBox.Checked without the OnClick being called
- From: Hans-Peter Diettrich <DrDiettrich1@xxxxxxx>
- Date: Sun, 10 Jun 2007 18:07:32 +0200
Maarten Wiltink wrote:
Why couldn't we just have one universal standard for a boolean,
whereby 1 is true and 0 is false? Isn't that a hell of a lot simpler?
'Standards are wonderful. So many to choose from.'
As was explained in another post, there are also sound reasons to use
(-1) for true. There are disadvantages to that, too, most importantly
that comparing the underlying values as integers will result in True
being less than False.
In an unsigned interpretation, False <= X <= True will hold.
Such systems typically have only one set of boolean operators, working bitwise on integral values, and have no special boolean type. The value of True is the consequence from
True == not False
and
X and True == X
A signed True value of -1 will expand to whatever operand size is used, by propagation of the sign bit, in contrast to any unsigned value, which would be extended with zeroes.
It gets worse. When using an integer as a status code, zero means
'success' and any other value means 'failure'. Because there's only
one way for things to work right, but endless ways for them to go
wrong.
That's why the Windows API's typically use Integer results, not boolean ones - at least this was the original paradigm. The requirement for the LongBool etc. Delphi data types comes from pseudo-boolean C subroutine arguments, where the caller expects the value encoded in a certain number of bytes, whereas a Delphi "boolean" would be passed only as a single byte[1]. I wonder why the use of those pseudo-boolean types is not restricted to the use with arguments of external subroutines - adding implicit conversion to true boolean types and values, in expressions, IMO was a bad decision.
[1] The requirement of a fixed argument size also might be the reason, why we don't have true enums or sets for some of the API function arguments. Explicitly sized enums and sets really would be a nice feature, for API or other C interfaces.
Another possibility is the time I was confused by someone (a
mathematician, I have no doubt) who represented False by 1 and True
by... 2. The entire book started counting enumerations at one. It
was somewhat trying.
This also might be related to array indexing, where Basics frequently start with 1, unless they allow for an "Option Base 0". The same legacy exception with Delphi strings, whose first character have the index 1. A StringBase option had been nice, introduced together with dynamic strings and {$HugeStrings+}.
DoDi
.
- References:
- Set the CheckBox.Checked without the OnClick being called
- From: Fons
- Re: Set the CheckBox.Checked without the OnClick being called
- From: John Dough
- Re: Set the CheckBox.Checked without the OnClick being called
- From: Rob Kennedy
- Re: Set the CheckBox.Checked without the OnClick being called
- From: Nicholas Sherlock
- Re: Set the CheckBox.Checked without the OnClick being called
- From: John Dough
- Re: Set the CheckBox.Checked without the OnClick being called
- From: Hans-Peter Diettrich
- Re: Set the CheckBox.Checked without the OnClick being called
- From: John Dough
- Re: Set the CheckBox.Checked without the OnClick being called
- From: Rudy Velthuis
- Re: Set the CheckBox.Checked without the OnClick being called
- From: John Dough
- Re: Set the CheckBox.Checked without the OnClick being called
- From: Maarten Wiltink
- Set the CheckBox.Checked without the OnClick being called
- Prev by Date: Re: Set the CheckBox.Checked without the OnClick being called
- Next by Date: Re: Set the CheckBox.Checked without the OnClick being called
- Previous by thread: Re: Set the CheckBox.Checked without the OnClick being called
- Next by thread: Re: Set the CheckBox.Checked without the OnClick being called
- Index(es):
Relevant Pages
|