<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'>A quick look on google groups finds what may be an
even more elegant solution:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<pre><font size=2 face="Courier New"><span style='font-size:10.0pt'>Q. "Is there a way to use the return key for data entry, instead of tab or the<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> mouse?"<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>A. Use this code for an Edit's OnKeyPress event.<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> begin<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> If Key = #13 Then<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> Begin<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> SelectNext(Sender as tWinControl, True, True );<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> Key := #0;<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> end;<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> end;<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> This causes Enter to behave like tab. Now, select all controls on the form<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> you'd like to exhibit this behavior (not Buttons) and go to the Object<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> Inspector and set their OnKeyPress handler to EditKeyPress. Now, each<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> control you selected will process Enter as Tab. If you'd like to handle<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> this at the form (as opposed to control) level, reset all the controls<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> OnKeyPress properties to blank, and set the _form_'s OnKeyPress property to<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> EditKeyPress. Then, change Sender to ActiveControl and set the form's<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'> KeyPreview property to true:<o:p></o:p></span></font></pre>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span lang=EN-US style='font-size:10.0pt;font-family:Tahoma'>
delphi-bounces@ns3.123.co.nz [mailto:delphi-bounces@ns3.123.co.nz] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Darrell.Olsen@sungard.com<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, 22 April 2005 4:57
p.m.<br>
<b><span style='font-weight:bold'>To:</span></b> delphi@ns3.123.co.nz<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [DUG] Re: DBGrid</span></font><span
lang=EN-US><o:p></o:p></span></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Trap the KeyUp event on the DB grid, if
the enter key was hit, post tab KeyDown and KeyUp messages, i.e:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>procedure TForm1.MyDBGrid1KeyUp(Sender:
TObject; var Key: Word; Shift: TShiftState);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>begin<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> if Key = VK_RETURN then<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> begin<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> SendMessage ( MyDBGrid1.Handle,
WM_KEYDOWN, VK_TAB, 0);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> SendMessage (
MyDBGrid1.Handle, WM_KEYUP, VK_TAB, 0);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> end<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>end;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'><o:p> </o:p></span></font></p>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span lang=EN-US
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span lang=EN-US style='font-size:10.0pt;font-family:Tahoma'>
delphi-bounces@ns3.123.co.nz [mailto:delphi-bounces@ns3.123.co.nz] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Robert Wilson<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, 22 April 2005 3:43
p.m.<br>
<b><span style='font-weight:bold'>To:</span></b> delphi@ns3.123.co.nz<br>
<b><span style='font-weight:bold'>Subject:</span></b> [DUG] Re: DBGrid</span></font><span
lang=EN-US><o:p></o:p></span></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
</span></font><font size=2 face=Arial><span style='font-size:10.0pt;font-family:
Arial'><br>
Hi</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Friday
afternoon and Help!!</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Trying
to get enter key to behave like tab in a dbgrid. I'm sure it is something
really simple that I i'm missing!</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Help
would be appreciated.</span></font> <br>
<br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Cheers</span></font>
<br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Robert</span></font>
<br>
<br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Cellular
Cellnet Ltd NZ.</span></font> <o:p></o:p></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p class=MsoNormal><strong><b><font size=3 color=red face="Times New Roman"><span
style='font-size:12.0pt;color:red'>Attention: </span></font></b></strong><br>
Disclaimer: <o:p></o:p></p>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>The
information in this electronic mail message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this Internet
electronic mail message by anyone else is unauthorised. <o:p></o:p></span></font></p>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>If you
are not the intended recipient, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it is prohibited and may be
unlawful. <br>
If you have received this e-mail by mistake please call the sender
immediately on 09 415 4747 and erase the original message and any attachments.<o:p></o:p></span></font></p>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Cellular
Cellnet (NZ) Ltd accepts no responsibility for any effects this email message
or attachments has on the recipient network or computer system. <o:p></o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
</div>
</body>
</html>