On May 22 11:14 97, Fred Burgess of 1:226/580 wrote:
FB> Ok, looking at the 'Online Help' doesn't tell me what I need to know.
FB> I'm looking for a way to jump to the next field not only with a TAB
FB> but using the ENTER (CR, ^+M, #13). I have looked through 5 of my
FB> books also, and have not seen this touched upon.
FB> Any help would be appreciated.
This is from the Forms OnKeyPress event. This will change fields with the
enter key. To move to the next record you will still have to press the tab
key.
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then { if it's an enter key }
if not (ActiveControl is TDBGrid) then begin { if not on a TDBGrid }
Key := #0; { eat enter key }
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end
else if (ActiveControl is TDBGrid) then { if it is a TDBGrid }
with TDBGrid(ActiveControl) do
if selectedindex < (fieldcount -1) then { increment the field }
selectedindex := selectedindex +1
else
selectedindex := 0;
end;
Chris
--- Msgedsq 2.2e
---------------
* Origin: Esc1.71 - When you're old enough to drive the bus. (1:157/534.30)
|