Page 1 of 3
Force the script editor to update?
Posted: Mon Apr 22, 2024 12:45 pm
by Zax
Hello,
Is there a way to force the script editor to update its tabs when closing a stack?
If I close a stack
with locked messages and have some of its scripts opened in the script editor, the editor doesn't update and its tabs become nonsense.
On the other hand, if I close a stack with unlocked messages, the script editor updates correctly.
Of course, I could also close the script editor completely but that would also close the scripts of the other opened stacks, and that's not what I want.
The following tests are very simple to perform:
Code: Select all
on mouseUp
lock messages
close this stack
-- look at the script editor and cry
end mouseUp
Code: Select all
on mouseUp
close this stack -- OK
end mouseUp
Re: Force the script editor to update?
Posted: Mon Apr 22, 2024 1:25 pm
by richmond62
You can make the script editor 'split' into separate windows for each script, then you can close the script windows for the stack you are closing and leave ones for other stacks open.
-
Re: Force the script editor to update?
Posted: Mon Apr 22, 2024 2:45 pm
by dunbarx
Hi.
So I understand, is it that the tabs stay alive when messages are locked? And you believe these tabs are now valueless?
If so, I get what you are saying, but also say that everything is working as advertised. After, all, even with the stack closed, you can still edit the scripts, and even save them, assuming the stack itself has only been closed and not removed from memory.
So what is the downside, apart from having those tabs cluttering up the place?
Craig
Re: Force the script editor to update?
Posted: Mon Apr 22, 2024 6:11 pm
by Zax
Nice trick Richmond62

Though, I would prefer a "full script" way, if possible.
dunbarx wrote: ↑Mon Apr 22, 2024 2:45 pm
If so, I get what you are saying, but also say that everything is working as advertised. After, all, even with the stack closed, you can still edit the scripts, and even save them, assuming the stack itself has only been closed and not removed from memory.
Sorry, I forgot to mention the closed stack was removed from memory. In this case, if you have several script editor tabs, with ones concerning the closed stack, and others concerning other opened stacks, tabs seem to no longer correspond to the right edited scripts. I'll make other tests in order to be more accurate.
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 8:03 am
by Zax
Here is my testing procedure:
1 - opening a test stack, let's call it "TestStack"
2 - opening another stack, let's call it "AnyStack"
3 - editing the script of some controls of the "AnyStack" stack
4 - editing the script of some controls of the "TestStack" stack
5 - the "TestStack" stack has its destroyWindow and destroyStack enabled
6 - at this point, the script editor has several tabs, referring to our 2 stacks
7 - execution of the script:
Code: Select all
on mouseUp
lock messages
close stack "TestStack"
end mouseUp
8 - "TestStack" is now closed and removed from memory, but the tabs of the script editor referring to the closed stack are still open and
no longer clickable. You can only close them manually.
So I'm looking for a way to automatically close these inactive tabs by script when closing the "TestStack" stack
with the locked messages.
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 8:29 am
by richmond62
I just opened 2 stacks, and 2 script editor windows: 1 for an object in the first stack, and 1 for a script in the second stack.
When I closed the first stack, the script editor for the object in that stack closed too.
What am I missing?
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 9:09 am
by Zax
richmond62 wrote: ↑Tue Apr 23, 2024 8:29 am
What am I missing?
Maybe "lock messages" before closing?
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 9:20 am
by richmond62
First of all, I opened my 2 stacks and their scripts, then typed lock messages into the messageBOx: no difference.
Secondly . . .
Opened your stack:
-
-
And, as you explained, the script editors remain open when the stack is closed.
However, I have to ask: Why are you locking the messages in the first place?
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 9:37 am
by Zax
richmond62 wrote: ↑Tue Apr 23, 2024 9:20 am
However, I have to ask: Why are you locking the messages in the first place?
For information, it is for the script of a button of a personal development tools palette which must close in a somewhat brutal way the stacks which I no longer use.
When developing, I often open several stacks to copy elements or pieces of scripts, and my screens and the Project Browser quickly become cluttered, so I would like to quickly close a few stacks that I no longer need.
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 9:39 am
by richmond62
my screens and the Project Browser quickly become cluttered
Erm: how many screens do you have?
I still do not understand why it is necessary for you to lock messages.
Aha:
Use the lock messages command when a handler performs an action (such as opening a stack) and you want to speed up access by preventing unnecessary navigation messages (such as openStack) from being sent.
Well, obviously one of the "unnecessary navigation messages" concerns closing script editor windows.

Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 9:52 am
by Zax
richmond62 wrote: ↑Tue Apr 23, 2024 9:39 am
Use the lock messages command when a handler performs an action (such as opening a stack) and you want to speed up access by preventing unnecessary navigation messages (such as openStack) from being sent.
Well, obviously one of the "unnecessary navigation messages" concerns closing script editor windows.
And also the famous "Would you like to save stack..." dialog when closing a stack you have not really modified

Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 10:05 am
by richmond62
Well, it is unfortunate that
lockMessages does not have parameters so you can choose which of the "unnecessary navigation messages" you want to prevent working and which ones you do not want to prevent.
It would be wonderful if one could do this sort of thing (pseudo-code):
Code: Select all
set the lockMessages to true without scriptEditor
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 10:19 am
by richmond62
-
I know this is extremely tedious, but one way to cope with this situation is to choose which messages to suppress.
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 11:19 am
by Zax
At least it would be useful if I could retrieve the list of open scripts in the editor. I could thus check if the stack that I want to close has some of its scripts edited, and warn.
Re: Force the script editor to update?
Posted: Tue Apr 23, 2024 12:31 pm
by richmond62
What is not clear to me (yet) is whether 'suppress messages' means:
1. Stop those messages from running.
or only
2. Stop those messages from showing up in the Message Watcher.