Page 1 of 1

Function Call

Posted: Wed Jul 05, 2017 1:39 am
by RossG
I have a function "Clear Numbers" which can be run
either from a button "Clear Numbers" or be called
from another function.

I want to warn the user when the function is called
from the "Clear Numbers" button but not when it's
called from another function.

Recall but can't find mention of getting the ID of
the last button pressed.

Help appreciated.

Re: Function Call

Posted: Wed Jul 05, 2017 4:50 am
by bogs
Well, I don't know about last button pressed, but this sounds like a case for the use of target , ie. in the script at card level the button is on,

Code: Select all

on mouseUp
if the target is button "Clear Numbers" then 
answer "warning, you've pressed a button that clears the numbers"
/* call the function */
end if
end mouseUp
or more simply, just put the dialog call in the mouseUp code of the button itself, not in the general function clear numbers.

As for the id of the last anything (except fields I think), you can get the id with
get the id of the last target
use answer instead of get if you want to see the id pop up.
Image