It is currently April 27th, 2024, 10:48 am

mouse action still works over an empty space

Get help with creating, editing & fixing problems with skins
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

mouse action still works over an empty space

Post by Kotofanchik »

Question. There is a meter that displays a picture - a png file. Did a mouse action on him. And it turned out that if the file itself is not physically there, then the mouse still works over an empty space. How can I prevent the mouse from working when there is no file?

Code: Select all

[MeterAlertImageJ]
Meter=image
MeasureName=MeasureAlertStringJ1
Path="#CURRENTPATH#WeatherIconsSmall"
X=185
Y=288
W=22
H=22
AntiAlias=1
ToolTipType=1
Hidden=0
MouseOverAction=!Execute [!RainmeterShowMeter MeterAlertStringJ] [!RainmeterRedraw] | [!RainmeterShowMeter MeterAlertHeadJ] [!RainmeterRedraw]
MouseLeaveAction=!Execute [!RainmeterHideMeter MeterAlertStringJ] [!RainmeterRedraw] | [!RainmeterHideMeter MeterAlertHeadJ] [!RainmeterRedraw]
There may or may not be a picture on the Internet indicating a weather warning, I would like to prevent the mouse from triggering over the missing icon when there is no warning
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: mouse action still works over an empty space

Post by balala »

Kotofanchik wrote: March 15th, 2024, 7:35 pm There may or may not be a picture on the Internet indicating a weather warning, I would like to prevent the mouse from triggering over the missing icon when there is no warning
I'd try to hide the above meter when there is no icon. Not knowing how exactly how the [MeasureAlertStringJ1] measure is looking like, I can just assume that this can be done by using the following options on that measure (keep the code of the existing measure, just add these options to the existing measure):

Code: Select all

[MeasureAlertStringJ1]
...
IfMatch=^$
IfMatchAction=[!HideMeter "MeterAlertImageJ"]
IfNotMatchAction=[!ShowMeter "MeterAlertImageJ"]
The IfMatch=^$ condition is met when the above [MeasureAlertStringJ1] is returning nothing (or in fact when it returns empty string). In this case IfMatchAction is executed, leading to hiding the meter. When the measure is returning something (so when an icon / image has to became visible), IfNotMatchAction is executed and accordingly the meter is shown. When a meter is hidden, the MouseOverAction and MouseLeaveAction can't be and aren't executed.
If the above solution doesn't work, post please the whole code of your skin, or since most probably resources are used (and I don't mean here the images, which for sure are used, but most probably to some included files, which are needed in order to can get the skin working) even better pack please the whole config and upload the package here.

Additional infos:
  • Both the !Execute bang and the !Rainmeter... bang prefix has been long time ago deprecated, you should renounce to them:

    Code: Select all

    [MeterAlertImageJ]
    ...
    MouseOverAction=[!ShowMeter MeterAlertStringJ][!Redraw][!ShowMeter MeterAlertHeadJ][!Redraw]
    MouseLeaveAction=[!HideMeter MeterAlertStringJ][!Redraw][!HideMeter MeterAlertHeadJ][!Redraw]
  • You can't use pipe between bangs. See that I removed them from the above posted options. Not sure what did you want to achieve by them, but they definitely can't be used.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: mouse action still works over an empty space

Post by Kotofanchik »

It worked. Thank you.
I will try to remove outdated commands.
There is a problem. I have Measure in a separate file and being there it does not hide Meter, but directly in front of it, it works. Although the Strings themselves are transmitted without any problem this way and that.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: mouse action still works over an empty space

Post by balala »

Kotofanchik wrote: March 15th, 2024, 9:39 pm It worked. Thank you.
I'm glad.
Kotofanchik wrote: March 15th, 2024, 9:39 pm I will try to remove outdated commands.
Recommend to remove them, even if the skin works even with them.
Kotofanchik wrote: March 15th, 2024, 9:39 pm I have Measure in a separate file and being there it does not hide Meter, but directly in front of it, it works. Although the Strings themselves are transmitted without any problem this way and that.
If the separate file is included into the skin with an @Include... option (make sure it is: look for a @Include=#@#TheINCFile.inc or something similar option), the content of this file is behaving exactly like it was in the skin itself. The IfConditions or IfActions do work and hide or show the meters right like they would be placed into the skins .ini file. You don't have to add anything to the bangs, they are just working. Believe me, I worked with such things extremely long.
If those bangs are not working, most probably there is something else. But to can further help you, the package containing the skin and all needed resources would be fine, as has been described above, along with a description of which is exactly the option which is not working and what is not hiding.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: mouse action still works over an empty space

Post by Kotofanchik »

Removed old commands. Everything is working.
There is a line @Include1=#@#Measures.inc and everything works as one file. Except that it doesn't work. :) I got out of the situation by moving only these MeasureAlertString to the same file. And it helped. Even if it's strange.
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: mouse action still works over an empty space

Post by balala »

Kotofanchik wrote: March 15th, 2024, 10:15 pm Removed old commands. Everything is working.
There is a line @Include1=#@#Measures.inc and everything works as one file. Except that it doesn't work. :) I got out of the situation by moving only these MeasureAlertString to the same file. And it helped. Even if it's strange.
It is, because if the file is included, doesn't really matter where the measure is. But I'm glad if you finally got it working as expected.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: mouse action still works over an empty space

Post by Kotofanchik »

I continue to design the skin. I want each new icon image to appear to the right of the previous one. But again the problem is that there is still space behind the missing and hidden icon.
There are a lot of icons and I can’t know which one will be on the site. I would like the first one found to be on the left side, the next one after it, and so on.
About the same as here
Pic.JPG
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: mouse action still works over an empty space

Post by Yincognito »

Kotofanchik wrote: March 18th, 2024, 11:45 pm I want each new icon image to appear to the right of the previous one. But again the problem is that there is still space behind the missing and hidden icon.
There are a lot of icons and I can’t know which one will be on the site. I would like the first one found to be on the left side, the next one after it, and so on.
About the same as here
Pic.JPG
Generally speaking, if I correctly understood what you want and assuming a standard code in your skin, this is a matter of positioning. Absolute / hardcoded positioning (e.g. X=10 for the 1st icon, X=40 for the 2nd and so on, assuming an icon size of 20 pixels with 10 pixels gap between them) will indeed leave an empty space when you hide an icon. What you want is relative positioning, see:
https://docs.rainmeter.net/manual/meters/general-options/#XY

However, that alone is not enough in such a case, because of the Note from the Hidden option on the above page (which basically means that hidden meters like your icons don't occupy space, but the gaps between them, being independent of the actual meters' "contents", still do and they accumulate even if the meters themselves are hidden, something quite obvious for meters that are not on the sides of the "list").

Therefore, one easy solution is to not use any gap in the relative positioning and instead replicate the gap using the Padding option, also described on the above page (in effect, making the gaps part of the meters themselves, so that they are hidden along with the actual icons).

In code, taking the example above, this would translate to something like:

Code: Select all

[Icon1]
Meter=Image
X=10
Y=10
W=20
Padding=0,0,10,0
...

[Icon2]
Meter=Image
X=0R
Y=0r
W=20
Padding=0,0,10,0
...

...
Notice the X, Y and Padding of the 2nd icon above, which would be replicated for the 3rd, the 4th, and so on. Obviously,
the non zero values above can be adjusted to your preference.

Also, take into account that the above will NOT work for missing icons, since the defined W or Padding are independent of whether the image file exists or not - unless, of course, the missing icons are automatically hidden using the IfMatch approach suited for your case and described by balala above.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: mouse action still works over an empty space

Post by Kotofanchik »

Yincognito wrote: March 19th, 2024, 2:19 am Also, take into account that the above will NOT work for missing icons, since the defined W or Padding are independent of whether the image file exists or not - unless, of course, the missing icons are automatically hidden using the IfMatch approach suited for your case and described by balala above.
That is the problem
We managed to hide the icons, but the fact that they continue to take up space makes the skin ugly.
Relative positioning does not work as it should due to the occupied space.
Kotofanchik
Posts: 95
Joined: March 15th, 2024, 7:30 pm

Re: mouse action still works over an empty space

Post by Kotofanchik »

Do something like

IfMatch=^$
IfMatchAction=[W=0 H=0 X=0 Y=0]
IfNotMatchAction=[!ShowMeter "MeterAlertImageJ"]

Is this possible?