It is currently September 29th, 2024, 5:19 am

Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

General topics related to Rainmeter.
User avatar
jsmorley
Developer
Posts: 22783
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by jsmorley »

Without digging too deep into your code, and since I don't have any of the images you are using, I would give the following general advice:

Try to stay away from "hiding / showing" meters on MouseOverAction / MouseLeaveAction. That is pretty old-school, and was more appropriate before we had the !SetOption bang.

This can be particularly troublesome when using "R" relative positioning on the meters.

The trouble is that a "hidden" meter still exists. While it is in effect a "singularity", with a width and height of zero, it still occupies a point in space when it has an X or Y on it. So if you have a mouse over event that hides a meter that has an X, and there are meters after it that are positioned relative to it with "R", they will still be relative to the hidden meter's X, and not for instance the meter above it in the skin that isn't hidden. Relative positioning is based on the relation to the immediately prior meter, and will be even if that meter is hidden.

So my point is, if you have three meters, the second and the third of which are your "hide /show" swapping pairs, any relative positioning of the third one, with say X=10R, will be 10 pixels relative to the second meter, even if the second meter is hidden.

So for the three meters, lets pretend we have:

Meter1: X=0
Meter2: X=10R
Meter3: X=10R

Meter3 is hidden at the start... Now we mouse over something, that hides Meter2 and shows Meter3. Sounds good, but let's look at the positioning. Meter3 will start 20 pixels after Meter1, NOT 10 pixels. While Meter2 has no "width" when hidden, it's still sitting there as a singularity 10 pixels after the right-hand side of Meter1. Meter3 will start 10 pixels after that.

So my advice is to forget about "hide / show" as a way to do mouse over events. Just use !SetOption to change the position, size, color, font, image name, text or anything else that you want on a single meter. On the mouse leave event, you can just change it back.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterBack]
Meter=Image
W=100
H=30
SolidColor=47,47,47,255
MouseOverAction=[!SetOption MeterChange FontColor "255,0,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption MeterChange FontColor "255,255,255,255"][!UpdateMeter *][!Redraw]

[MeterChange]
Meter=String
X=50
Y=15
StringAlign=CenterCenter
FontSize=11
FontColor=255,255,255,255
AntiAlias=1
Text=Item 1
gif.gif
Again, I don't know for sure that this is the root of your problem, but using "hide / show" with meters and relative positioning is at best challenging to get right, and for the most part just isn't needed.
You do not have the required permissions to view the files attached to this post.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by strawberryshortcake »

This post was created before jsmorley posted the above. I'll read the above after I submit this post. This was more of an experimental post. I completely stripped everything down to the bare bones with a very short code/script;; (side note: mouseover was simply to change the font of the text but wanted to keep the text at the same location)

Image




Here's the entire code. Very, very barebones.

Code: Select all

[Rainmeter] 
Update=1000
DynamicWindowSize=1
AccurateText=1



[Variables]


[MeterBack]
Meter=IMAGE
ImageName=
Hidden=0


=================================





;==================================


[app2]
Meter=STRING
x=0
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="PHOTOSHOP"
MouseOverAction=[!RainmeterShowMeter app2over][!RainmeterHideMeter app2][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]


[app2over]
Meter=String
x=0
FontColor=255,255,255
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="PHOTOSHOP"
MouseLeaveAction=[!RainmeterHideMeter app2over][!RainmeterShowMeter app2][!Redraw]
LeftMouseDownAction=["C:\Program Files (x86)\Adobe Photoshop CS6\Photoshop.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]
Hidden=1


;==================================



[app14]
Meter=STRING
x=200
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="TRAY"


[app14over]
Meter=String
x=200
FontColor=0,0,225
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="TRAY"

;==================================


User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by strawberryshortcake »

jsmorley wrote:Without digging too deep into your code, and since I don't have any of the images you are using, I would give the following general advice:

Try to stay away from "hiding / showing" meters on MouseOverAction / MouseLeaveAction. That is pretty old-school, and was more appropriate before we had the !SetOption bang.

This can be particularly troublesome when using "R" relative positioning on the meters.

The trouble is that a "hidden" meter still exists. While it is in effect a "singularity", with a width and height of zero, it still occupies a point in space when it has an X or Y on it. So if you have a mouse over event that hides a meter that has an X, and there are meters after it that are positioned relative to it with "R", they will still be relative to the hidden meter's X, and not for instance the meter above it in the skin that isn't hidden. Relative positioning is based on the relation to the immediately prior meter, and will be even if that meter is hidden.
So my point is, if you have three meters, the second and the third of which are your "hide /show" swapping pairs, any relative positioning of the third one, with say X=10R, will be 10 pixels relative to the second meter, even if the second meter is hidden.

So for the three meters, lets pretend we have:

Meter1: X=0
Meter2: X=10R
Meter3: X=10R

Meter3 is hidden at the start... Now we mouse over something, that hides Meter2 and shows Meter3. Sounds good, but let's look at the positioning. Meter3 will start 20 pixels after Meter1, NOT 10 pixels. While Meter2 has no "width" when hidden, it's still sitting there as a singularity 10 pixels after the right-hand side of Meter1. Meter3 will start 10 pixels after that.

So my advice is to forget about "hide / show" as a way to do mouse over events. Just use !SetOption to change the position, size, color, font, image name, text or anything else that you want on a single meter. On the mouse leave event, you can just change it back.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterBack]
Meter=Image
W=100
H=30
SolidColor=47,47,47,255
MouseOverAction=[!SetOption MeterChange FontColor "255,0,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption MeterChange FontColor "255,255,255,255"][!UpdateMeter *][!Redraw]

[MeterChange]
Meter=String
X=50
Y=15
StringAlign=CenterCenter
FontSize=11
FontColor=255,255,255,255
AntiAlias=1
Text=Item 1
gif.gif

Again, I don't know for sure that this is the root of your problem, but using "hide / show" with meters and relative positioning is at best challenging to get right, and for the most part just isn't needed.

Image


The X-direction and the distance between each word works perfectly as desired with the implementation of the new code. Makes things so much simplier and less code lines.

Yes, I've tried tasklist (y=15) and (Y=0R) for Photoshop,(Y=0R) blender, and (Y=0R)chrome and it still offsets with a massive gap different in the y-direction.

My concern now falls on the Y-direction when I followed the manual
Examples:
X=150 : Meter begins 150 horizontal pixels from the right edge of the skin window.
Y=75 : Meter begins 75 vertical pixels from the top edge of the skin window.

X=10R : Meter begins 10 horizontal pixels to the right of the previous meter.
Y=0r : Meter begins at the same vertical position as the previous meter.
Doing the same for the Y direction didn't work as I had hoped. I must be doing something wrong.

Code: Select all

[Rainmeter] 
Update=1000
DynamicWindowSize=1
AccurateText=1



[Variables]


[MeterBack]
Meter=Image
ImageName=.png


;==================================


[app1]
Meter=STRING
x=100
y=15
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="TASKLIST"
MouseOverAction=[!SetOption app1 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app1 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\TaskList.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]



[app2]
Meter=STRING
x=20R
y=0R
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="PHOTOSHOP"
MouseOverAction=[!SetOption app2 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app2 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Program Files (x86)\Adobe Photoshop CS6\Photoshop.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]


[app3]
Meter=STRING
X=20R
y=2R
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="BLENDER"
MouseOverAction=[!SetOption app3 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app3 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Users\Johnny\Desktop\Desktop Folders\Blender PROJECTS\blender-2.77a-windows64\blender-2.77a-windows64\blender.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]



[app4]
Meter=STRING
X=20R
y=2R
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="CHROME"
MouseOverAction=[!SetOption app4 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app4 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["http://www.yahoo.com"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]



[app5]
Meter=STRING
X=20R
y=60
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="DOWNLOADS"
MouseOverAction=[!SetOption app5 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app5 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Users\Johnny\Downloads"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]



[app6]
Meter=STRING
X=20R
y=60
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="MEDIA CENTER"
MouseOverAction=[!SetOption app6 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app6 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["%windir%\ehome\ehshell.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by strawberryshortcake »

Managed to figure out the problem with the Y - coordinate. I overlooked a very simple, but crucial detail. Upper case vs lower case letter matters. Since upper case "R" was used for the X - coordinate, one must distinguish Y-coordinate value using a lower case "r"

Image

Code: Select all

[app1]
Meter=STRING
x=200
y=15
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="TASKLIST"
MouseOverAction=[!SetOption app1 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app1 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\TaskList.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]



[app2]
Meter=STRING
x=20R
y=0r
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="PHOTOSHOP"
MouseOverAction=[!SetOption app2 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app2 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Program Files (x86)\Adobe Photoshop CS6\Photoshop.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]


[app3]
Meter=STRING
X=20R
y=0r
SolidColor=0,0,0,1
FontColor=0,0,0
StringStyle=BOLD
FontSize=15
FontFace=Century Gothic
StringEffect=SHADOW
FontEffectColor=8A8A8A
Padding=5,5,5,5
AntiAlias=1
Prefix="BLENDER"
MouseOverAction=[!SetOption app3 FontColor "255,255,255"][!UpdateMeter *][!Redraw][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"]
MouseLeaveAction=[!SetOption app3 FontColor "0,0,0"][!UpdateMeter *][!Redraw]
LeftMouseDownAction=["C:\Users\Johnny\Desktop\Desktop Folders\Blender PROJECTS\blender-2.77a-windows64\blender-2.77a-windows64\blender.exe"][PLAYSTOP][PLAY "C:\Users\Johnny\Documents\Rainmeter\Skins\Water Taskbar\@Resources\sound\water drops.wav"][!Redraw]


User avatar
eclectic-tech
Rainmeter Sage
Posts: 5534
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by eclectic-tech »

strawberryshortcake wrote:Managed to figure out the problem with the Y - coordinate. I overlooked a very simple, but crucial detail. Upper case vs lower case letter matters. Since upper case "R" was used for the X - coordinate, one must distinguish Y-coordinate value using a lower case "r"
Not quite right... :uhuh:

All meters in Rainmeter are rectangular.

Relative positioning has 2 points that can be used as references, the upper left corner of the rectangle of the previous meter, and the lower right corner of the rectangle of the previous meter. That is why there are 2 values 'r' and 'R'.

The lower case 'r' will align the current meter to the upper left 'X' or 'Y' coordinate of the previous meter.

The uppercase 'R' will align the current meter to the lower right 'X' or 'Y' coordinate of the previous meter.

I am glad to see you achieved the positioning.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by strawberryshortcake »

eclectic-tech wrote:Not quite right... :uhuh:

All meters in Rainmeter are rectangular.

Relative positioning has 2 points that can be used as references, the upper left corner of the rectangle of the previous meter, and the lower right corner of the rectangle of the previous meter. That is why there are 2 values 'r' and 'R'.

The lower case 'r' will align the current meter to the upper left 'X' or 'Y' coordinate of the previous meter.

The uppercase 'R' will align the current meter to the lower right 'X' or 'Y' coordinate of the previous meter.

I am glad to see you achieved the positioning.
This is why I'm not a programmer :D and do things visually ... It "looked" like a good explanation in my head based on the visual feedback I was getting after saving the .ini file and refreshing the skin.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5534
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help with Spacing: Between words (last letter of 1st word and first letter of 2nd word), and "Box distance"?

Post by eclectic-tech »

We all learn things differently and that's great! :thumbup:

I felt your explanation might confuse new users and wanted to explain what you were 'seeing', and why it worked...

Your project is looking good. Keep coding and asking questions; that's how we all learn! 8-)