![]() |
|
|
|
|
|
|
|
|
6
20th October 05:37
External User
Posts: 1
|
"name" <e@mail.add> skrev i melding
news:0V9%a.20811$vo2.9893@newsread1.news.atl.earth link.net... me The upper version is pure nonsense. I'd have to look at it twice to possibly use one more minute trying to figure out what on earth he'd been up to. Another point: A "Negative" statement is slightly harder to comprehend than the "positive" one: "negative": if not Button1.Enabled then DoIfDisabled else DoIfEnabled; vs. "positive": if Button1.Enabled then DoIfEnabled else DoIfDisabled; The other principle is that the "most likely", or "what the routine is made for" is placed first, if a test splits up execution routes like in these examples. Which one is most important, I won't say for sure... -- Regards, Bjørge Sæther bjorge@haha_itte.no ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq. |
|
|
7
1st November 16:46
External User
Posts: 1
|
"name" <e@mail.add> skrev i melding
news:PFc%a.16022$BC2.10485@newsread2.news.atl.eart hlink.net... It's setting Key := Key, which is a NOP (No OPeration). More clear: if Key in ['0'..'9',#08] then // do nothing... else Key := #0; -- Regards, Bjørge Sæther bjorge@haha_itte.no ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq. |
|
|
9
1st November 16:48
External User
Posts: 1
|
In article <iEe%a.22948$vo2.19745@newsread1.news.atl.earthlin k.net>, "name"
<e@mail.add> writes: Few procedures define something which leaves everything as it is. In general the program sets values by option depending on values, or alters a default action in certain conditions. Only for aditional clarity is a "do-nothing" action declared. The default activity is to have no action on an event, only if action is desired is an event handler defined. I do not know of any increase in clarity by filling one's program with ... procedure TMyForm.SomeEvent(Sender : TObject); begin // do nothing end; So an event handler changes values. In this particular case code only for changes to implement the pseudo-code ... if the key pressed is not 0 - 9 or backspace, then stop the key having any effect. Done clearly, succintly, and effectively by ... const BackSpace = #8; if not Key in ['0'..'9', Backspace] then Key := #0; Any additional code is verbiage - which is usually (and is so in this case) confusing. Please "name" (whoever you may be but are afraid to reveal your name) do not reply - I feel an attack of irrascible irritation coming on <g>. Alan Lloyd alanglloyd@aol.com |
|