Tabbing in a TDBCtlGrid

From: adze (_adsmi_a_telstra_d_com__at_nospam.com)
Date: 03/21/05


Date: Mon, 21 Mar 2005 23:44:02 +1100

Hi there

I have D7.1 Pro & WinXP Pro SP2.

My application has a TDBCtlGrid with two controls, a TDBText and a
TDBEdit. When the TDBEdit has focus and I press the tab key, focus
moves to the same control in the next panel of the grid. If I click on
the grid outside the TDBEdit (ie, on the TDBText), then the panel gets a
dotted line just inside its border to show that it has focus. Now, when
I press the tab key (or backtab key) nothing happens. The dotted line
remains on the same panel in the grid. Note that I can still use the
arrow keys to move up and down panels in the grid, I just can't get
focus back on the TDBEdit without using the mouse.

I have tried trapping the tab key in the TDBCtlGrid's OnKeyDown and
OnKeyPress events without success. It appears that pressing the tab key
doesn't fire either of these events. The TDBText control doesn't have
OnKeyDown or OnKeyPress events.

I came across the following text in the help entry for the KeyPreview
Property: "Navigation keys (Tab, BackTab, the arrow keys, and so on) are
unaffected by KeyPreview because they do not generate keyboard events."

This seems to suggest that I shouldn't be able to trap a TAB press in
the OnKeyPress event, which I can't. It also seems to say that I
shouldn't be able to trap an arrow key press, which I can.

I want to be able to select a panel in the TDBCtlGrid and then set focus
on the TDBEdit without using the mouse; preferably by using the tab or
backtab key.

What am I doing wrong? Any ideas or suggestions?

tia, Adze