1 (edited by oAk 2014-05-07 13:37:42 pm)

Topic: How to make ntray toggle?

Hi as the topic says i'm trying to make the nTray Toggle when clicking on a button, but the only bangs available as i know is nShow and nHide how can i make use of them to toggle the ntray or is there some other way ?

EDIT:
Right now i have set it to work like this:

    *On LeftClickUp none !execute [!nHide nTray]
    *On RightClickUp none !execute [!nShow nTray]

But dont really want to have it like that hoping that a proper toggle feature in implemented to this.

P.S When setting the command "Hidden" on ntray does not make it start hidden :S

2

Re: How to make ntray toggle?

Doesn't look like there is an !nToggle yet, but I thought of one way it should work.

It'll take two buttons instead of one though:

*nLabel TrayHidden
*nLabel TrayShown

*TrayHiddenOn LeftClickUp none !execute [!nShow nTray][!nHide TrayHidden][!nShow TrayShown]
*TrayShownOn LeftClickUp none !execute [!nHide nTray][!nShow TrayHidden][!nHide TrayShown]

Location, size etc should be identical for both, plus you can have a different image to show the state of the tray hiddenness.

P.S. Can confirm that it doesn't work here either.

3

Re: How to make ntray toggle?

okey, gonna give it a go, any ideas ono why that hidden command wont work ? :S

4

Re: How to make ntray toggle?

I would put it down to nModules still being somewhat of a work in progress, not every feature is implemented yet.
Does it work on other elements (taskbar, labels etc)?

5

Re: How to make ntray toggle?

i'm using the the above example for the toggle on ntray
and it works when i'm using it on the trayhidden label.

6

Re: How to make ntray toggle?

So im updating this if anyone is interested, did manage to make
a simple toggle function with help of JavaScript (AWESOME BTW) big_smile

basically i made a simple nLabel that represent the button

// this is in my label.rc file
*nLabel trayToggle
trayToggle
{
    AlwaysOnTop True
    X 0
    Y 0
    Width 10
    Height 10
    BrushType image
    Image tray\tray.png
    HoverImage tray\trayhover.png

         // so instead of calling the nShow or nHide function here i call a javascript function that i have in the script.js file
    *On LeftClickUp none !execute [!nExecScript toggleTray()]
}

and in my script js file i put this

// Gets the value of nTrayHidden with the litestep object
var hidden = LiteStep.Evars.Get("nTrayHidden")
// function to toggle the tray on or off
var toggleTray = function() 
{
    if (hidden) 
    {
        nCore.Window.Show("nTray");
        //sets the value hidden to false when ntray is being shown, otherwise you can't show it again
        hidden = false;
    }
    else
    {
        nCore.Window.Hide("nTray");
        // here i set the hidden value to true after it hides the ntray
        hidden = true;
    }
};

and now i dont need to set two labels in my rc config, FREAKING AWESOME big_smile
So gonna learn some more javascript cause Litestep is gonna be awesome now !! big_smile

7

Re: How to make ntray toggle?

I have created a file in my personal dir called script.js with the exact code as you. When trying to call it with

*On MiddleClickUp none !execute [!nExecScript toggleTray()]

I recieve an error from litestep

ReferenceError: toggleTray is not defined
Line 1 of !nExecScript

Even though the function is declared within the script.js file

Any one able to see the problem?

8

Re: How to make ntray toggle?

Glitch wrote:

I have created a file in my personal dir called script.js with the exact code as you. When trying to call it with

*On MiddleClickUp none !execute [!nExecScript toggleTray()]

I recieve an error from litestep

ReferenceError: toggleTray is not defined
Line 1 of !nExecScript

Even though the function is declared within the script.js file

Any one able to see the problem?

did you include the script.js file ?
sry for late reply, havent gotten any email notification hmm

9

Re: How to make ntray toggle?

At the top of my theme.rc I have

nIncludeScript     "$PersonalDir$script.js"

10

Re: How to make ntray toggle?

Glitch wrote:

At the top of my theme.rc I have

nIncludeScript     "$PersonalDir$script.js"

haven't been using litestep since new install of w10, but found one of themes with all configs.

i have my script include almost at bottom after all my other config includes.
and also
instead of

nIncludeScript

try

*nIncludeScript

11

Re: How to make ntray toggle?

Unbelievable! A single asterisk fixed it. Thanks very much oAK wink