I like David's version but why not get rid of the "not" to:<div><br></div><div>DBCheckBox4.Enabled := DBEdit2.Text <> '';</div><div><br></div><div>Cheers,</div><div><br><div><br><div class="gmail_quote">
On 27 April 2010 09:40, Ian Drower <span dir="ltr"><<a href="mailto:idrower@gmail.com">idrower@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
Hi Bob<br>
I'd use <br>
if DBEdit2.Text <> '' then<br>
DBCheckBox4.Enabled := true<br>
else<br>
DBCheckBox4.Enabled := false<br>
<br>
Ian<div><div></div><div class="h5"><br>
<br>
<br>
On 27/04/2010 10:52 a.m., David O'Brien wrote:
</div></div><blockquote type="cite"><div><div></div><div class="h5">
<div>
<p class="MsoNormal"><span style="font-size:11pt;color:rgb(31, 73, 125)">Why
the four quotes in the false and a space in the true?</span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:rgb(31, 73, 125)"> </span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:rgb(31, 73, 125)">I
would use something like:</span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:rgb(31, 73, 125)"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt">DBCheckBox4.Enabled
:=
not (DBEdit2.Text = '') ;</span><span style="font-size:11pt;color:rgb(31, 73, 125)"></span></p>
<p class="MsoNormal"><span style="font-size:11pt;color:rgb(31, 73, 125)"> </span></p>
<div>
<div style="border-style:solid none none;border-color:rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10pt" lang="EN-US">From:</span></b><span style="font-size:10pt" lang="EN-US"> <a href="mailto:delphi-bounces@delphi.org.nz" target="_blank">delphi-bounces@delphi.org.nz</a>
[<a href="mailto:delphi-bounces@delphi.org.nz" target="_blank">mailto:delphi-bounces@delphi.org.nz</a>] <b>On Behalf Of </b>Bob Pawley<br>
<b>Sent:</b> Tuesday, 27 April 2010 10:39 a.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Subject:</b> [DUG] Enable CheckBox</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal"><span style="font-size:10pt">Hi</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">I
am attempting to enable a checkbox only when a DBEdit has a value.
(Disabled
when no string in DBEdit.)</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">Following
is my code which disables the CheckBox after a delete from the DBEdit.</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">But
it is not enabled when I add a string to the DBEdit.</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">------</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">procedure
TForm4.DBEdit2Change(Sender: TObject);<br>
begin</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">
if<br>
DBEdit2.Text = ' '</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">
then<br>
DBCheckBox4.Enabled := True</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">
Else if DBEdit2.Text = ''''</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">
then<br>
DBCheckBox4.Enabled := False ;</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">end;</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">Thanks
for any help.</span></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10pt">Bob</span></p>
</div>
</div>
</div></div><pre><fieldset></fieldset>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a> with Subject: unsubscribe</pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div></div>