Proc function to identify triggering action

Author: None (None)

I have a simple form with one field (say NAME) and two buttons (OK and CANCEL). Clicking on either of these button triggers the Leave Field Trigger of Name when cursor is on NAME field.
I what to know which button triggers the Leave Field Trigger, is there any Proc function like ($fieldname ) to identify the button (OK/CANCEL/or tabing from NAME field)?


  1. Hi siva,

    not quite sure what you want, so let me give an example:

    On your form, there is the filed X1 and other fields painted, some as simple fields, some as buttons.

    your cursor is located in field X1.
    So whenever you click with the mouse on another field (be it a  button or a simple field),
    the structure editor (the machine inside running the application-user-interface) activates the "Leave Field" at first.

    In this field related trigger $fieldname points the the field X1, because this is the one which is left.
    The "landing field" is not known at that particular moment in all circumstances (but you may experiment if $prompt delivers something useful).


    There is another way to do it which is a "deferred" execution and works only with buttons:

    The buttons are specified as "CONTROL", so clicking these will NOT start the Leave Field trigger of X1 straight.
    And BTW: $fieldname will still point to X1.

    In the Detail Trigger of these Buttons, you may put the following Code:

    $STARTED_FROM$ = "OK" ; or Cancel for the other Button
    macro "^ACCEPT"   ; or macro "^QUIT" to do the cancel

    This will start the ACCEPT processing where the Leave Field of X1 is one of the first triggers executed.
    ^QUIT will just leave the Form without activating all these Triggers except the QUIT Trigger.

    There you can check $STARTED_FROM$, but be aware that the Leave Field trigger may be fired because of othe events as well.

    Author: ulrich-merkel (
  2. Thanks ulrich-merkel.

    Your explanation is really nice. I've used "differed execution" (button with control characteristic), it worked for me.

    Author: None (None)
  3. $prompt is not useful in these circumstances, it is set to null.

    Author: Iain Sharp (
  4. Hi Iain,

    thanks for that confirmation; unfortunately, I have currently no access to a uniface environment to test these kind of things.


    Author: ulrich-merkel (

    This may sound like a crazy solution but couldn’t you surround the button with four small map widgets, then in the extended rollover triggers of those widgets set a component variable to the name of the button?  Then in the leave field trigger test the contents of this variable to determine which button was pressed? And if the mouse is moved away from the button without pressing it the rollover trigger would clear the variable.

    Author: dmanchester (
  6. If want to do the crazy thing, then it would be better to replace the entire button with a map widget that has a picture of a button.

    Author: Theo Neeskens (