Quick Quiz - Which control FEQ has focus?

What are the two ways to get the FEQ of the control which has focus at the time of any field-specific event?

You would use it something like this:

CASE Event()
OF EVENT:Accepted
OROF EVENT:Selected
  IF <do something here> = ?MyControl
    ! Do some code magic 
  END
END

Oh, I should mention that there could well be more than 2! At the time of writing I am only aware of 2…

if Accepted() = ?MyControl

As a guess for the other

if Field() = ?MyControl

Hey Mark,

Actually yes those two would have worked. I was after something more general than the IF Accepted() = though.

I have updated the example to add an additional OROF to the CASE statement:

OF EVENT:Accepted
OROF EVENT:Selected

Your guess on Field() is correct but I discovered another one today which is why I thought I might post this quiz!

I guess (again)
if focus() = ?myField

Oh sneaky! That would work with EVENT:Selected but not EVENT:Accepted right?

I am going to say no on that one. The idea is to have something that would work for both events. Essentially another way of writing Field()

Are you looking for ?
as in IF ? = ?MyField

Hey other Mark. Yes, that is the one! Actually I was using it like this:

IF ?{PROP:FEQ} = ?MyField

Of course the PROP:FEQ is totally redundant, I had never seen the ? usage before but obviously didn’t really think it though!

So the answers to the quiz are:

Answer 1

CASE Event()
OF EVENT:Accepted
OROF EVENT:Selected
  IF Field() = ?MyControl
    ! Do some code magic 
  END
END

Answer 2

CASE Event()
OF EVENT:Accepted
OROF EVENT:Selected
  IF ? = ?MyControl
    ! Do some code magic 
  END
END