Script editor

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
anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Script editor

Post by anmldr » Thu Jan 29, 2015 5:42 pm

Is there a preference setting to show tabs for all controls that have scripts in the card that is currently being edited? Or to you have to keep the script editor open all of the time to keep all of the scripts that have been edited in tabs in the script editor?

For instance, I click on a button and add code. There is a tab for that script. I click on another button and add script and it has a tab. If for some reason I have to close the script editor then those scripts are no longer there in the tabs for that card.

Not a biggie...just wondering if it is possible to open all tabs automatically for all controls that currently have scripts for the card that is visible.

Linda

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Script editor

Post by dunbarx » Thu Jan 29, 2015 7:50 pm

Hi.

I have never seen a way to restore recently opened script tabs if you close the editor itself. You can always minimize, instead of closing, the editor of course.

That said, since it is possible to edit the scripts of any control under, er, script control:

Code: Select all

on mouseUp
edit the script of control "yourControl1"
edit the script of control "yourControl2"
edit the script of control "yourControl3"
end mouseUp
You can always maintain a list of the controls of interest in a custom property and restore that way.

Craig Newman

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Script editor

Post by Mikey » Fri Jan 30, 2015 2:20 pm

Or, how about

on mouseUp
repeat with i = 1 to the number of controls on this card
if i is the id of me then next repeat #skip me
if the script of control i of this card is not empty then edit the script of control i of this card
end repeat #for i = 1 to the number of controls on this card
end mouseUp

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Script editor

Post by dunbarx » Fri Jan 30, 2015 3:26 pm

Linda, Mike..

Surely if you want to open all the non-empty scripts of all controls, this will do it. You might want to add the script of the card itself as well as the stack. But this would get cumbersome with a lot of controls, no?

Usually I have only a few scripts being examined at any one time, depending on what part of the project I am dealing with, and it is only those that I would rather reload in a new session. This requires keeping track of those controls, likely in a custom property.

Now the question arises: how does one automatically track those controls when using shortcuts? There is no "openScript" or "editScript" message, sent when, say, you click on a control with the option and command keys held down, or when you use the inspector. In fact, I find it very difficult to trap any message at all when that shortcut is used, or from the inspector. These actions seem to take their own sweet path, short-circuiting message sending entirely.

If you write some universal script-opening gadget, this problem goes away, but I have been cmd-opt-clicking for so long I will not change. What do you think?

Craig

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Re: Script editor

Post by anmldr » Fri Jan 30, 2015 6:48 pm

Like I wrote, it isn't a big deal. I just am really exploring the how's and why's in LiveCode to develop my own preferences for how to use it. I just seemed awkward to have to simply click on a control and then click on the code icon in the toolbar each time. cmd-opt-click sounds good. :)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Script editor

Post by jacque » Sat Jan 31, 2015 9:43 pm

I just seemed awkward to have to simply click on a control and then click on the code icon in the toolbar each time.
Yes. That's why Cmd-Opt-Shift-click is my favorite thing. It gives you a contextual menu for most of the things you can do with a control, including editing its script and its behavior script (very handy.) If you are using the edit tool, then Cmd-Opt-click opens the script immediately provided your preferences are set to allow that (General pane.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Script editor

Post by bogs » Tue Jun 20, 2017 4:00 am

anmldr wrote:Is there a preference setting to show tabs for all controls that have scripts in the card that is currently being edited? Or to you have to keep the script editor open all of the time to keep all of the scripts that have been edited in tabs in the script editor?
I realize this is an older topic, but (at least in all the Lc versions I have access too) there *is* something like the original poster was looking for.

In the project browser, just clicking on the blue bubble at the end of whatever you want to code will open it in the editor, whether its open or not. It is also fairly small on screen up to vers. 7.x anyway. Just my .02 for the future finders of this thread :)
fasterScriptAccessProjectBrowser.png
Accessing which controls have scripts and open the editor...
fasterScriptAccessProjectBrowser.png (16.46 KiB) Viewed 5054 times
Image

Post Reply