• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

StringGrid - change tab into return

Hi there,

How do you change the tab key into return in a TStringGrid.  I thought I might have been able to do it in the OnKeyDown event (if Key=VK_TAB then Key := VK_RETURN), but that didn't work.

It doesn't seem like the stringgrid is passed the tab press.

Any clues at all?

Many thanks,

Stu.
0
PAG_Promax
Asked:
PAG_Promax
  • 2
  • 2
1 Solution
 
MerijnBSr. Software EngineerCommented:
Which OnKeyDown event did you try? What behavior do you want to see if you press tab?
0
 
PAG_PromaxAuthor Commented:
At the moment when I press enter in the grid it cycles through the cells, moving from left to right, then down a row at the last column and starting from the first column again.  So, what I want is for this same behaviour to happen with the tab key.

What do you mean by which OnKeyDown event did I try?  The grid only has the one.
0
 
MerijnBSr. Software EngineerCommented:
> What do you mean by which OnKeyDown event did I try?  The grid only has the one.

It's possible you had Form.KeyPreview set to true and grabbed the KeyDown event of the form.

For your problem:

The StringGrid has an options property, set goTabs to true. Now you will receive tab key presses in your grid's OnKeyDown event, which you can change.
0
 
PAG_PromaxAuthor Commented:
You rule, MerijnB.  Thank you very much for what ended up being such a simple solution.  I didn't even know that option existed.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now