It is currently October 21st, 2019, 4:07 am

Bringing a skin to the "Front" or sending to the "Back"

Tips and Tricks from the Rainmeter Community
User avatar
jsmorley
Developer
Posts: 19591
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Bringing a skin to the "Front" or sending to the "Back"

jsmorley » May 11th, 2009, 6:56 pm

Rainmeter skins by default sit on the desktop and if another window is in front of them they are covered up and inaccessible. You can use the !ZPos "bang" to control where in the stack of windows on your desktop your skins appear. Think of "ZPos" as "forward" and "backward" on your desktop.

!ZPos
Changes the z-position of the window. -2 = OnDesktop, -1 = OnBottom, 0 = Normal, 1 = OnTop, 2 = Topmost.

This can be executed based on any event you like. For instance, if you get a new GMail message and you want to have a skin which checks your mail pop forward and let you know, it can be done using this bang when a measure has a certain value.

I use this bang to control a "dock" I have written to duplicate the functionality of ObjectDock / RocketDock using Rainmeter. I wanted the "dock" to come to the front when I moved the mouse over any part of it showing behind other windows, and return to the desktop when I move the mouse away.

Thanks to a timely bit of help from dragonmage, I have this working using ZPos and thought I would pass it along to others looking to control skins z-position.

[Rainmeter]
MouseOverAction=!execute [!ZPos 2]
MouseLeaveAction=!execute [!ZPos -2]

This brings the skin to the front on MouseOver, and sends it back to the desktop on MouseLeave.
Last edited by jsmorley on May 11th, 2009, 11:42 pm, edited 1 time in total.
WorMzy
Posts: 2
Joined: May 9th, 2009, 9:34 pm

Re: Bringing a skin to the "Front" or sending to the "Back"

WorMzy » May 11th, 2009, 10:01 pm

I can foresee this being very useful, thanks for the tip.
dragonmage
Developer
Posts: 1286
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Bringing a skin to the "Front" or sending to the "Back"

dragonmage » May 12th, 2009, 3:23 am

Glad that worked for you jsmorley.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: Bringing a skin to the "Front" or sending to the "Back"

killall-q » August 14th, 2009, 10:43 am

You won't believe how much more useful the Enigma Gmail checker is to me now that I added your functionality to it.

Code: Select all

[MeasureNumber]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureGmail]
StringIndex=1
UpdateRate=1
IfAboveValue=0
IfAboveAction=!execute [!RainmeterZPos 1]
IfEqualValue=0
IfEqualAction=!execute [!RainmeterZPos 0]
ZPos 0 is somewhat inelegant as I have to change windows before it goes back down. ZPos -1 puts it under the Enigma taskbar (can't use -2 for that, I'm on Windows 7). I'm having trouble figuring out a way to do -1, followed by 0, preferably using MouseOverAction.

Something more advanced - Can you use invisible topmost buttons to bring meters in front of a maximized window while they remain on the desktop?
KiRe
Posts: 35
Joined: July 25th, 2009, 5:49 am
Location: USA

Re: Bringing a skin to the "Front" or sending to the "Back"

KiRe » August 15th, 2009, 5:09 am

killall-q wrote: Something more advanced - Can you use invisible topmost buttons to bring meters in front of a maximized window while they remain on the desktop?
That reminds me of a question...

Does this zpos "trick" work even if rainmeter is complete covered by another window? If not, then what killall says might do the trick. All you would have to do is create a new skin which is basically an "invisible" box that is placed over all the skins so when you hover over the box it moves the zpos of the meters. In fact, you could just edit the code of any existing toolbar or sidebar... just add the mouseoveraction to move the zpos of the skins you want and then change the transparancy of the said toolbar/sidebar.
^ rainmeter noob.
User avatar
dilshad
Posts: 85
Joined: August 31st, 2012, 4:23 am

Re: Bringing a skin to the "Front" or sending to the "Back"

dilshad » January 23rd, 2014, 2:46 pm

I would like a skin to remain in back even if mouse is clicked on it or any kin is infront of it... It should always remain back.. What I need to do for this..
[ BOXES ]
I will be coming with it soon!

■■ DeviantartFacebookMy works ■■
gunthered
Posts: 3
Joined: July 22nd, 2014, 1:28 pm

Re: Bringing a skin to the "Front" or sending to the "Back"

gunthered » July 22nd, 2014, 1:36 pm

Is there a way to do this with variables within a skin? For example, I have multiple meter buttons in close proximity set up using images, and I want whatever button/image I'm mousing over to be brought to the front. Can post image/code if necessary.
User avatar
jsmorley
Developer
Posts: 19591
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bringing a skin to the "Front" or sending to the "Back"

jsmorley » July 22nd, 2014, 1:43 pm

gunthered wrote:Is there a way to do this with variables within a skin? For example, I have multiple meter buttons in close proximity set up using images, and I want whatever button/image I'm mousing over to be brought to the front. Can post image/code if necessary.
Not really. Meters within a skin do not actually have any "z-position" that can be changed. To understand this, it is important to remember that Rainmeter just "draws" all meters on a single window "canvas". There are no "layers", just whatever color is drawn to a particular screen pixel "last" wins. This is entirely driven by the order the meters are in the skin .ini code.

To simulate having a button move forward and back in what appears to be layers of buttons, you would need to have multiple versions of the meters, in a different order in the actual .ini code, and then hide and show them as needed.
gunthered
Posts: 3
Joined: July 22nd, 2014, 1:28 pm

Re: Bringing a skin to the "Front" or sending to the "Back"

gunthered » July 22nd, 2014, 1:52 pm

Thanks for the quick reply. Yeah, I tried multiple meters but didn't get anywhere. I was thinking there might be a way to use variables for the meters, for instance 0 = back, 1 = front, and then current mouseover set to 1.

Do you know of any skins that achieve this effect I'm looking for?
User avatar
jsmorley
Developer
Posts: 19591
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bringing a skin to the "Front" or sending to the "Back"

jsmorley » July 22nd, 2014, 1:56 pm

gunthered wrote:Thanks for the quick reply. Yeah, I tried multiple meters but didn't get anywhere. I was thinking there might be a way to use variables for the meters, for instance 0 = back, 1 = front, and then current mouseover set to 1.

Do you know of any skins that achieve this effect I'm looking for?
I don't. It quickly gets complicated to manage using multiple meters, as the mouse over / leave actions are hard to deal with when meters are hidden / shown as they then toggle between "detected" and "undetected" by the mouse. I'm sure there is a way to get there, but it's not something that Rainmeter can do in any really easy way, and it will take a bit of Rube Goldberg code to achieve it in my view.