Function Call

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
RossG
Posts: 247
Joined: Thu Jan 08, 2015 7:38 am

Function Call

Post by RossG » Wed Jul 05, 2017 1:39 am

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.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Function Call

Post by bogs » Wed Jul 05, 2017 4:50 am

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
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”