Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: PSS and JScript interaction (Read 3766 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

PSS and JScript interaction

How can I make sure that, on start up, the code in a JScript panel is executed before the title formatting script in the panel stack splitter is evaluated? Is that even possible in the first place?
The JScript panel is in forced layout mode in order to make sure it is resized on startup (the code that needs to be executed first is triggered by an on_size function), and on top of the layout tree, but that doesn't seem to help.
I'm late


Re: PSS and JScript interaction

Reply #2
I'm not sure this is a known behavior, at least I was not aware of it. In order to find out the bug in a script I'm working on, I outputted the window width and height of the JScript panel to the console with a fb.trace statement triggered by the on_size event. It turns out the on_size event is called twice on panel stack splitter start up, apparently once before the panel layout is applied and once after.

To make it clearer, this is the PSS code, forcing the JScript panel layout:
Code: [Select]
$movepanel_c(JScript Panel,0,0,%ps_width%,%ps_height%)
this is the code in the JScript panel:
Code: [Select]
function on_size(){
    fb.Trace("ww: " + window.Width + "\nwh: " + window.Height);
}
and here's the console log after clicking on the OK button in the Splitter Settings dialog window:

ww: 0
wh: 0
ww: 1366
wh: 641

Is this expected? And is there a way to prevent it, anyhow, or do I just have to deal with it?
I'm late


Re: PSS and JScript interaction

Reply #4
Thanks for sharing.
I'm late



 

Re: PSS and JScript interaction

Reply #7
Why? I thought only PSS was accountable for the double callback, is it not so?
On startup I'm guessing many containers will initially have a width of 0 and height of 0. I use a single horizontal splitter with JScript on one side, and my on_size gets called 3x before w/h is anything other than 0 (although at least one is manually done in my on_init).

Re: PSS and JScript interaction

Reply #8
On startup I'm guessing many containers will initially have a width of 0 and height of 0. I use a single horizontal splitter with JScript on one side, and my on_size gets called 3x before w/h is anything other than 0 (although at least one is manually done in my on_init).

I see, however I can't reproduce said behavior: on my horizontal splitters, jscript on_size event is called once only.

BTW, what is the on_init callback? I can't find no reference in the JScript panel docs. Is it part of the new features of version 2?
I'm late