Lots of Editing
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Lots of Editing
I'm not clever enough to write common code for a lot
of buttons (but will get to it eventually).
Is there some way of opening half a dozen or so "on mouseUp"
other than the "four-click" method i.e.
Click on group
Click on "Edit Group"
Click on the button.
Click on Editor button.
I know (and use) the fact that once opened in the
Editor they're available on the drop-down but getting
them there is the rub.
of buttons (but will get to it eventually).
Is there some way of opening half a dozen or so "on mouseUp"
other than the "four-click" method i.e.
Click on group
Click on "Edit Group"
Click on the button.
Click on Editor button.
I know (and use) the fact that once opened in the
Editor they're available on the drop-down but getting
them there is the rub.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Lots of Editing
Oh Yes you are !...'m not clever enough to write common code for a lot of buttons

There are 5 buttons on the card
Buttons 1 through to 4 would have common code, so that you don't have to keep repeating the script in each button we can use a 'behavior button' to control them...
Easy to set up... look in the stack script..
Easy to control and make changes and additions... look in the script of the button 'buttonbehavior'
- Attachments
-
- Untitled 1.livecode.zip
- (1.13 KiB) Downloaded 255 times
Re: Lots of Editing
Hi.
What Dixie said.
And you are probably well past the ability to place a single "mouseUp" handler in the group script, something like:
Craig Newman
What Dixie said.
And you are probably well past the ability to place a single "mouseUp" handler in the group script, something like:
Code: Select all
on mouseUp
answer the name of the target
doStuffJustForThatSpecificButtonSinceYouAlreadyKnowWhichOneYouClicked
end mouseUp
Re: Lots of Editing
As mentioned, behaviors are the best way to handle shared scripts. But for future reference, the fastest way to get to an object script is:
Make sure the "Select grouped controls" icon in the toolbar is bolded.
Hold down option-command and click on the object.
Another way is to select the object with the edit tool and click the script icon in the toolbar.
A third way is to hold down option-command-shift, right click the object, and choose to edit the script from the contextual menu.
If you are on Windows, substitute the alt key for "option" and the control key for "command" in the above.
Make sure the "Select grouped controls" icon in the toolbar is bolded.
Hold down option-command and click on the object.
Another way is to select the object with the edit tool and click the script icon in the toolbar.
A third way is to hold down option-command-shift, right click the object, and choose to edit the script from the contextual menu.
If you are on Windows, substitute the alt key for "option" and the control key for "command" in the above.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Lots of Editing
This is my answer to my query.
Open stack.
Open Project Browser.
If necessary expand group to find the button.
Click once on graphic at right which shows the number of lines of code.
Code opens in Editor.
Open as many bits of code as you want.
Open stack.
Open Project Browser.
If necessary expand group to find the button.
Click once on graphic at right which shows the number of lines of code.
Code opens in Editor.
Open as many bits of code as you want.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Lots of Editing
Not only but also...
If I clone a number of buttons can I change the
on mouseUp code to suit e.g. if the original
button is Button1
on mouseUp
put field Zero1 into field Numbers1
end mouseUp
The the first clone (Button2) would need
on mouseUp
put field Zero2 into field Numbers2
end mouseUp
Since nothing is impossible with LC (so far)
it's just a matter of knowing the right words.
If I clone a number of buttons can I change the
on mouseUp code to suit e.g. if the original
button is Button1
on mouseUp
put field Zero1 into field Numbers1
end mouseUp
The the first clone (Button2) would need
on mouseUp
put field Zero2 into field Numbers2
end mouseUp
Since nothing is impossible with LC (so far)
it's just a matter of knowing the right words.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Lots of Editing
You could give each button a custom property called, say, MyFields. With this code as a behavior…RossG wrote:Not only but also...
If I clone a number of buttons can I change the
on mouseUp code to suit e.g. if the original
button is Button1
on mouseUp
put field Zero1 into field Numbers1
end mouseUp
The the first clone (Button2) would need
on mouseUp
put field Zero2 into field Numbers2
end mouseUp
Since nothing is impossible with LC (so far)
it's just a matter of knowing the right words.
Code: Select all
on mouseUp
put field (item 1 of the MyFields of me) into field (item 2 of the MyFields of me)
end mouseUp