Most Efficient Method?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Most Efficient Method?
Call a commonly used routine from a BUTTON, FIELD or CUSTOM PROPERTY?
-
-
- Attachments
-
- Efficiency Q.livecode.zip
- Here's the stack.
- (1.51 KiB) Downloaded 151 times
Re: Most Efficient Method?
Actually, wouldn't the more efficient way to do this be
...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 -
* 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
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
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 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
Last edited by bogs on Wed Feb 27, 2019 1:51 pm, edited 2 times in total.
Re: Most Efficient Method?
Most effective is to put this into a handler in the card or stack script:
And just execute it when clicking the button or field:
Using a Custom Property this way does not seem to be effective at all.
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
Code: Select all
on mouseup
your_fancy_stuff
end mouseup
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Most Efficient Method?
Thanks Klaus.
I made this stack using LiveCode 8.1.10 on macOS 10.14.
The "Do FIELD" button works under those parameters.
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?
Sure, but "do" is always slower than direct access/execution of the script.richmond62 wrote: ↑Wed Feb 27, 2019 3:37 pmThanks Klaus.
I made this stack using LiveCode 8.1.10 on macOS 10.14.
The "Do FIELD" button works under those parameters.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Most Efficient Method?
It's just been one of those zippy-de-doo-da days:"do" is always slower
https://www.youtube.com/watch?v=6bWyhj7siEY