Proc function to identify triggering action
Author: None (None)
Hi,
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)?
Thanks,
siva
6 Comments
Local Administrator
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 (ulrichmerkel@web.de)
Local Administrator
Thanks ulrich-merkel.
Your explanation is really nice. I've used "differed execution" (button with control characteristic), it worked for me.
Author: None (None)
Local Administrator
$prompt is not useful in these circumstances, it is set to null.
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
Hi Iain,
thanks for that confirmation; unfortunately, I have currently no access to a uniface environment to test these kind of things.
Uli
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Author: dmanchester (dave.manchester@nucor.com)
Local Administrator
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 (tneeskens@itblockz.nl)