Page 1 of 1
Most Efficient Method?
Posted: Wed Feb 27, 2019 1:33 pm
by richmond62
Call a commonly used routine from a BUTTON, FIELD or CUSTOM PROPERTY?
-
Re: Most Efficient Method?
Posted: Wed Feb 27, 2019 1:45 pm
by bogs
Actually, wouldn't the more efficient way to do this be
Code: Select all
set the backGroundColor of btn "B2" to red
send "set the backGroundColor of btn "B2" to blue" to this stack in 2 seconds
...Or at least, the less blocking version I guess...
As far as running the sample goes, I had the following results -
* click the 'do button' button, worked
* click the 'do field' button produced the following error -
Code: Select all
button "Do FIELD": execution error at line 2 (do: error in source expression) near "set the backGroundColor of btn "B2" to red", char 1
* click the 'do cust.prop' button worked
* click the script button worked.
Edit - for those of us that are modern challenged, may want to include the least version it will work in as well

Re: Most Efficient Method?
Posted: Wed Feb 27, 2019 1:46 pm
by Klaus
Most effective is to put this into a handler in the card or stack script:
Code: Select all
command your_fancy_stuff
set the backGroundColor of btn "B1" to red
wait 2 secs
set the backGroundColor of btn "B1" to blue
end your_fancy_stuff
And just execute it when clicking the button or field:
Code: Select all
on mouseup
your_fancy_stuff
end mouseup
Using a Custom Property this way does not seem to be effective at all.
Re: Most Efficient Method?
Posted: Wed Feb 27, 2019 3:37 pm
by richmond62
Thanks Klaus.
I made this stack using LiveCode 8.1.10 on macOS 10.14.
The "Do FIELD" button works under those parameters.
Re: Most Efficient Method?
Posted: Wed Feb 27, 2019 3:59 pm
by Klaus
richmond62 wrote: ↑Wed Feb 27, 2019 3:37 pm
Thanks
Klaus.
I made this stack using LiveCode 8.1.10 on macOS 10.14.
The "Do FIELD" button works under those parameters.
Sure, but "do" is always slower than direct access/execution of the script.
Re: Most Efficient Method?
Posted: Wed Feb 27, 2019 4:09 pm
by richmond62
"do" is always slower
It's just been one of those zippy-de-doo-da days:
https://www.youtube.com/watch?v=6bWyhj7siEY