cursor positions

This is related to having a function (F1) that can do 2 functions on the same screen. They are pressing 
F1 instead of clicking on the button.

It is a 15 line scroll screen with search functions at the bottom of the screen.

You can click on the scroll line and press F1 to see the details of this line.

At the bottom of the screen you can leave blank or key in a value and press F1 to search by this value.

the row is still selected and I still want to show that so they know what record was last selected.

Now I want to click on the search entry field and key in a value. When I press F1 at this time it still thinks it is going to do

the details function instead of the search function.

I want to trap the position of the cursor when I click on the search entry box to know I am in that field.

Is there a way to do that on a graphical screen?

Thanks,
David