6.5.2 Doesn't Remember Script Editor Location

Ray ray at linkit.com
Fri Jan 31 17:17:19 EST 2014


Mark,

That's a very interesting message you're working with here; the 
'editScript' message.  I wasn't aware of that one.

It seems like that would be the logical place to trap for something like 
this but in a simple script such as this one inserted into the front...

on editScript
    put the openStacks
    pass editScript
end editScript

I'm only getting the following stacks listed in the message box:

revTools
Test
revMenubar

Notice the absence of the "revNewScriptEditor 1" stack.  This means, 
while trapping for the editScript message seems like it might work, it 
unfortunately doesn't work (at least I can't get to work) since the 
script editor window is, at the point editScript is trapped, not yet in 
existence.

I've also tried your handlers, below, and not had any better luck with 
them, I believe for the same reason that the script editor window isn't 
yet open when the editScript message is trapped.

Thanks anyway, though.  If you have any other suggestions I'd love to 
try them.

Ray

On 1/31/2014 4:30 PM, Mark Schonewille wrote:
> Hi Ray,
>
> When the script editor opens, the message seem to be locked. I tried 
> to trigger the preOpenStack message when the script editor opens in 
> MetaCard and that works perfectly. Apparently, the creator of the 
> LiveCode script editor doesn't want us to intercept messages while 
> editing a script in LiveCode.
>
> However, you can use the editScript message. "Unfortunately", this 
> message is sent to the control whose script is being edited and not to 
> the script editor. (I write "unfortunately" in quotes, because it is 
> still expected behaviour and necessary for the script editor to work).
>
> In the editScript message, you can loop through all stacks that 
> contain "revScriptEditor" in their short name and check that they are 
> on screen. Here's an example:
>
> constant lPreferredRect ="-1157,-111,-180,644"
> local lScriptEditorIsOpen
>
> on checkScriptEditorLocs
>    if lScriptEditorIsOpen is not true then
>       if there is a stack "revNewScriptEditor 1" then
>          set the rect of stack "revNewScriptEditor 1" to lPreferredRect
>          put true into lScriptEditorIsOpen
>       end if
>    end if
>    repeat for each line myStack in the windows
>       if myStack contains "revNewScriptEditor" then
>          put false into myVis
>          repeat for each line myRect in the screenRects
>             if there is a stack myStack then
>                if the topleft of stack myStack is within myRect or \
>                   the topRight of stack myStack is within myRect or \
>                   the bottomLeft of stack myStack is within myRect \
>                   or the bottomRight of stack myStack is within \
>                     myRect then
>                   put true into myVis
>                   exit repeat
>                end if
>             end if
>          end repeat
>          if myVis is false and there is a stack myStack then
>             set the loc of window myStack to the screenLoc
>          end if
>       end if
>    end repeat
> end checkScriptEditorLocs
>
> on editScript
>    put ("revNewScriptEditor" is in the openStacks) into \
>       lScriptEditorIsOpen
>    send "checkScriptEditorLocs" to me in 0 milliseconds
>    pass editScript
> end editScript
>
> Make sure that this script is in a front script.
>
> The funny thing is that while testing the script editor, I seem to 
> have broken it. Its default behaviour now is to open on my primary 
> screen. Therefore, I have added a little feature, which opens it on my 
> secondary screen, if no script editor is open yet. For me, this is 
> useful, because I edit all scripts in one window. Change the constant 
> at the top of the script to set the location where you want your 
> script editor to open. Let me know if you encounter any problems when 
> trying this script.
>
> -- 
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
> colour spaces. http://www.color-converter.com
>
> Buy my new book "Programming LiveCode for the Real Beginner" 
> http://qery.us/3fi
>
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
>
> On 1/30/2014 18:25, Ray wrote:
>> Let me know how it goes Mark.  I'd like to get a little more feedback
>> before writing a bug report.
>>
>> On 1/30/2014 12:18 PM, Mark Schonewille wrote:
>>> Ray, I'll try it myself, later tonight.
>>>
>>>
>>> -- 
>>> Best regards,
>>>
>>> Mark Schonewille
>>>
>>> Economy-x-Talk Consulting and Software Engineering
>>> Homepage: http://economy-x-talk.com
>>> Twitter: http://twitter.com/xtalkprogrammer
>>> KvK: 50277553
>>>
>>> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other
>>> colour spaces. http://www.color-converter.com
>>>
>>> Buy my new book "Programming LiveCode for the Real Beginner"
>>> http://qery.us/3fi
>>>
>>> LiveCode on Facebook:
>>> https://www.facebook.com/groups/runrev/
>>>
>>> On 1/30/2014 16:26, Ray wrote:
>>>> I'm not having any luck with inserting the following script into 
>>>> front:
>>>>
>>>> on preOpenStack
>>>>     put the ticks
>>>> end preOpenStack
>>>>
>>>> With this inserted I get a message box opened with the ticks when I 
>>>> open
>>>> another stack from the desktop, but no ticks when I shift-control-S to
>>>> open the stack script (the script editor window).  Evidently a script
>>>> inserted into the front doesn't get triggered when opening the script
>>>> editor.  Neither does the 'start using stack' method.
>>>>
>>>> Am I doing this right?
>>>>
>>>> Ray
>>>>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list