[DUG] Enable CheckBox
Jeremy Coulter
jscoulter at gmail.com
Tue Apr 27 12:50:23 NZST 2010
what about the following. Move it away from strings and make it numbers :-)
Control.Enabled := Length(Text) <> 0;
Jeremy
On Tue, Apr 27, 2010 at 12:34 PM, Jolyon Smith <jsmith at deltics.co.nz> wrote:
> Maybe it’s just me, but “A doesn’t equal B” surely reads more closely to
> the *real meaning* than “not (A does equal B)”.
>
>
>
> Apart from anything else, the latter *requires* parentheses to avoid the
> compiler getting confused and trying to do : “(Not A) equals (B)”. i.e. the
> latter syntax is also to the compiler less close to the real meaning (since
> it requires disambiguation).
>
>
>
> From a human perspective the scanning is more fluid: A <> B, reads left to
> right entirely as intended: “A does not equal B”.
>
>
>
> NOT (A = B) on the other hand requires me to read it like a syntax tree
> parser: “NOT “ … (OK, store the fact that I have to logically invert what
> follows, keep a mental note of parentheses) … then what follows is “( A is
> equal to B )” , right OK, so “A is equal to B inverted”, i.e. A does not
> equal B.
>
>
>
> In other words, exactly what is menat literally and clearly when I write… A
> <> B.
>
>
>
> But as I say, maybe it’s just me.
>
>
>
> NOT (I think like a computer).
>
>
>
> ;)
>
>
>
> *From:* delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
> *On Behalf Of *David O'Brien
> *Sent:* Tuesday, 27 April 2010 11:54 a.m.
>
> *To:* NZ Borland Developers Group - Delphi List
> *Subject:* Re: [DUG] Enable CheckBox
>
>
>
> Mainly because it makes me think about the real meaning when looking at the
> code again J.
>
>
>
> *From:* delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
> *On Behalf Of *Colin Johnsun
> *Sent:* Tuesday, 27 April 2010 11:47 a.m.
> *To:* NZ Borland Developers Group - Delphi List
> *Subject:* Re: [DUG] Enable CheckBox
>
>
>
> I like David's version but why not get rid of the "not" to:
>
>
>
> DBCheckBox4.Enabled := DBEdit2.Text <> '';
>
>
>
> Cheers,
>
>
>
>
>
> On 27 April 2010 09:40, Ian Drower <idrower at gmail.com> wrote:
>
> Hi Bob
> I'd use
> if DBEdit2.Text <> '' then
> DBCheckBox4.Enabled := true
> else
> DBCheckBox4.Enabled := false
>
> Ian
>
>
>
>
> On 27/04/2010 10:52 a.m., David O'Brien wrote:
>
> Why the four quotes in the false and a space in the true?
>
>
>
> I would use something like:
>
>
>
> DBCheckBox4.Enabled := not (DBEdit2.Text = '') ;
>
>
>
> *From:* delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz<delphi-bounces at delphi.org.nz>]
> *On Behalf Of *Bob Pawley
> *Sent:* Tuesday, 27 April 2010 10:39 a.m.
> *To:* NZ Borland Developers Group - Delphi List
> *Subject:* [DUG] Enable CheckBox
>
>
>
> Hi
>
>
>
> I am attempting to enable a checkbox only when a DBEdit has a value.
> (Disabled when no string in DBEdit.)
>
>
>
> Following is my code which disables the CheckBox after a delete from the
> DBEdit.
>
>
>
> But it is not enabled when I add a string to the DBEdit.
>
> ------
>
> procedure TForm4.DBEdit2Change(Sender: TObject);
> begin
>
>
>
> if
> DBEdit2.Text = ' '
>
>
>
> then
> DBCheckBox4.Enabled := True
>
>
>
> Else if DBEdit2.Text = ''''
>
>
>
> then
> DBCheckBox4.Enabled := False ;
>
>
>
> end;
>
>
>
> Thanks for any help.
>
>
>
> Bob
>
>
>
> _______________________________________________
>
> NZ Borland Developers Group - Delphi mailing list
>
> Post: delphi at delphi.org.nz
>
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
>
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100427/cc273c7f/attachment-0001.html
More information about the Delphi
mailing list