1 (edited by oAk 2014-05-12 21:00:19 pm)

Topic: scripting for a resize of taskbar

so have been scratching my head a little, dont know if im doing something wrong or something ...

i want my nTaskbar to change the width when i toggle mt nTray on or off,
i have my nTray setup that it toggles with javascript and when it hides it i set the nTrayWidth to 0 and when it shows i set it to 200,

now for the nTaskbar i have the width set to the following:

 $ResolutionX-ClockWidth-trayToggleWidth-nTrayWidth-nTaskbarX$  

and the width of the nTaskbar is perfect when my nTray i visible they are edge to edge.


this shows that when i hide the nTray the width is set to 0 and when it shows it's back to 200 just as i want it

 LiteStep.Execute('!nAlertScript LiteStep.Evars.Get("nTrayWidth")'); 

i also did the same thing when toggling, for the nTaskbarWidth

 LiteStep.Execute('!nAlertScript LiteStep.Evars.Get("nTaskbarWidth")');

and when i toggled the nTray off it shows a width of 1305 and when i toggle nTray on it shows 1505, so the nTraskbar value obviously get changed, but i can't seem to get the nTaskbar to actually change the size when i toggle the nTray...

kinda confusing i know hmm

oh and btw, yes i am using nModules and scripting in javascript smile

2 (edited by alur 2014-07-27 01:17:08 am)

Re: scripting for a resize of taskbar

The part you're missing is that the .RC file setting is only read by nTaskbar when it first loads. The taskbar will essentially ask the LiteStep core what the value of (taskbarPrefix)Width is, and it will give it back a number, say, 1305. The taskbar never knows that the width was based off the width of the system tray, nor does it know when the system tray sizes itself. That is just the way LiteStep works (though I suddenly feel inspired to build a config system where things would work as you expected).

Now, the way you get it to work is by setting nTrayOnResize to a command which you want to execute everytime the tray changes size.

I have this script to accomplish this in my theme:

//
// Sizes the elements of the taskbar, as necessary.
//
LiteStep.Evars.Set('SystemTrayOnResize', '!nExecScript SizeTaskbarElements()');
function SizeTaskbarElements()
{
    var taskbarWidth =
          nCore.Window.GetWidth('MainTaskbar')
        - nCore.Window.GetX("Taskbar")
        - nCore.Window.GetWidth("SystemTray")
        - nCore.Window.GetWidth("MainTaskbarClock");
        
    nCore.Window.Size('Taskbar', taskbarWidth, nCore.Window.GetHeight('Taskbar'));
}

I hope to eventually add support for JavaScript events, so that you don't have to go and set an evar for this, but it probably won't make it in for the next release.