I wasn't sure exactly how to word the subject so here is a better description.
I have a form with 16 fields that are all named 'Item' + an integer, i.e. 'Item1, Item2, item3, etc. I need to determine if a key press happened in any of those fields from the form key press event, I do NOT want to use the object key press event.
I can do something like,
if (Key = VK_END) and (form.activecontrol = form.findcomponent('Item1')) then do .....
if (Key = VK_END) and (form.activecontrol = form.findcomponent('Item2')) then do .....
if (Key = VK_END) and (form.activecontrol = form.findcomponent('Item3')) then do .....
or something like
if Key = VK_END then
begin
if form.activecontrol = form.findcomponent('item1') then do .....
if form.activecontrol = form.findcomponent('item2') then do .....
if form.activecontrol = form.findcomponent('item3') then do .....
end;
Either way will work but I was hoping to simplify the code in someway.
What the code will do is check if the user hit the 'end' key when in a specific tedit object and then also check if that specific tedit object is empty or not, if it is one of the specific tedits and that tedit is empty then I can continue to the next screen if it is not empty but the rest of that line is filled in correctly then I can also go to the next screen. If the tedit is a specific one and the rest of the line is not finished then I give a warning message and keep the focus on that tedit.
I can do this with a bunch of if statements but I hoped I could shrink it down with some fancy coding

Any suggestions?