It is currently March 28th, 2024, 5:37 pm

Next/Previous page button

Get help with creating, editing & fixing problems with skins
J0wNs
Posts: 32
Joined: June 16th, 2018, 9:27 pm

Next/Previous page button

Post by J0wNs »

It's me again.. :welcome:
This time I'm trying to make an icon that when clicked disables a group of icons (used to launch apps) and enables the next ones, similiar to a go to next page thing that when right-clicked goes to previous page as well. I've tried multiple things, groups, configs with show and hide meters, toggle config and stuff but none of them seem to be working, at least in my case. I can't figure out what I'm doing wrong, please help? Picture for reference: https://i.imgur.com/dbAbcrg.jpg
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next/Previous page button

Post by balala »

Post the code you have so far, please.
J0wNs
Posts: 32
Joined: June 16th, 2018, 9:27 pm

Re: Next/Previous page button

Post by J0wNs »

Code: Select all

[MeterSwitchIcon]
Group=Apps
Meter=Image
ImageName=#@#Images\PageSwitch.png
H=95

LeftMouseUpAction=[!WriteKeyValue Variables Page "((1+#Page#)%#NumOfPages#)"][!SetVariable Page "((1+#Page#)%#NumOfPages#)"][!UpdateMeasure "MeasurePage"][!UpdateMeter "#CURRENTSECTION#"]



[Variables]
Page=1
NumOfPages=2

[MeasurePage]
Measure=Calc
Formula=#Page#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowGroup "Apps" "Pyramidal\netflix"][!UpdateMeterGroup "Pyramidal\netflix"][!Redraw "Pyramidal\netflix"]
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!HideGroup "Apps" "Pyramidal\netflix"][!UpdateMeterGroup "Pyramidal\netflix"][!Redraw "Pyramidal\netflix"]
The way I thought this would work is kinda similiar to the wallpaper button, if you remember. I basically tested just an icon, but when a set of icon is removed, the next page should appear right after.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next/Previous page button

Post by balala »

There are more issues with this code:
  • The !ShowGroup / !HideGroup bangs used into the IfTrueAction options of the [MeasurePage] measure are used for something else: to show / hide group of skins, not group of meters (which Apps is). Replace them with !ShowMeterGroup / !HideMeterGroup and take care to not confuse them (I hope I am right).
  • If I am right and there you indeed have to use the !ShowMeterGroup / !HideMeterGroup bangs, the last parameter ("Pyramidal\netflix") of these bangs are useless. A such third parameter is needed when the meter group is into a different skin, than that in which you have the bang itself. Here isn't the case: the Apps group is placed into the same skin in which you have the bangs. So, remove these last parameters.
  • For a similar reason the [!UpdateMeterGroup "Pyramidal\netflix"][!Redraw "Pyramidal\netflix"] bangs of both IfTrueAction options are again useless. Instead of them you should have just redraw the skin. So, replace these bangs with a simple [!Redraw].
  • You have to number the IfCondition and the appropriate IfTrueAction options. You can't have two IfConditions and two IfTrueActions on a single measure. So, the second occurrences of them should have to be IfCondition2 and IfTrueAction2.
  • Both the [MeterSwitchIcon] meter and the [MeasurePage] measure use a variable which is set through !SetVariable bangs. They can't use it, unless you don't add a DynamicVariables=1 option to both. Don't forget it.
With all these changes, I think your code should have to look like this:

Code: Select all

[Variables]
Page=1
NumOfPages=2

[MeterSwitchIcon]
Group=Apps
Meter=Image
ImageName=#@#Images\PageSwitch.png
H=95
LeftMouseUpAction=[!WriteKeyValue Variables Page "((1+#Page#)%#NumOfPages#)"][!SetVariable Page "((1+#Page#)%#NumOfPages#)"][!UpdateMeasure "MeasurePage"][!UpdateMeter "#CURRENTSECTION#"]
DynamicVariables=1

[MeasurePage]
Measure=Calc
Formula=#Page#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeterGroup "Apps"][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!HideMeterGroup "Apps"][!Redraw]
DynamicVariables=1
J0wNs
Posts: 32
Joined: June 16th, 2018, 9:27 pm

Re: Next/Previous page button

Post by J0wNs »

It works, I only had to add the configs. Now I need to make the next page's icons appear after the previous' are removed. I've tried this:

Code: Select all

IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeterGroup "Apps" "Pyramidal\netflix"][!MeterGroup "Apps" "Pyramidal\youtube"][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!HideMeterGroup "Apps" "Pyramidal\netflix"][!Redraw][!ShowMeterGroup "Apps" "Pyramidal\youtube"][!Redraw]
And it seems to be working, could I make it better?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next/Previous page button

Post by balala »

J0wNs wrote:It works, I only had to add the configs. Now I need to make the next page's icons appear after the previous' are removed. I've tried this:

Code: Select all

IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeterGroup "Apps" "Pyramidal\netflix"][!MeterGroup "Apps" "Pyramidal\youtube"][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!HideMeterGroup "Apps" "Pyramidal\netflix"][!Redraw][!ShowMeterGroup "Apps" "Pyramidal\youtube"][!Redraw]
And it seems to be working, could I make it better?
Again there are three issues:
  • Doesn't worth to redraw the current skin (which the simply used !Redraw bang does), because the shown / hidden meters are into different skins / configs. You should have to replace the simple [!Redraw] bangs with those to redraw the others (updated) configs (see below).
  • Even if you would leave the [!Redraw] bangs, don't use two of them in the IfTrueAction option. They are not needed.
  • A !MeterGroup bang (which is used as the second bang of the IfTrueAction option), doesn't exist. It probably should have to be !HideMeterGroup. Fix this typo.

Code: Select all

IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeterGroup "Apps" "Pyramidal\netflix"][!HideMeterGroup "Apps" "Pyramidal\youtube"][!Redraw "Pyramidal\netflix"][!Redraw "Pyramidal\youtube"]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!HideMeterGroup "Apps" "Pyramidal\netflix"][!ShowMeterGroup "Apps" "Pyramidal\youtube"][!Redraw "Pyramidal\netflix"][!Redraw "Pyramidal\youtube"]
:thumbup:
J0wNs
Posts: 32
Joined: June 16th, 2018, 9:27 pm

Re: Next/Previous page button

Post by J0wNs »

Yeah about the meter group bang, it was just a typo that I fixed right after. It now works perfectly with each [!Redraw Config] but I'm left with a small issue, which is when I refresh all this happens: https://gfycat.com/FastShamelessBasil (youtube and folder icon are stacked). It's weird because the other ones return to their state based on the key value that's written.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next/Previous page button

Post by balala »

J0wNs wrote:I'm left with a small issue, which is when I refresh all this happens: https://gfycat.com/FastShamelessBasil (youtube and folder icon are stacked). It's weird because the other ones return to their state based on the key value that's written.
To be honest I didn't understand what that issue is related to. Could you please describe it?
J0wNs
Posts: 32
Joined: June 16th, 2018, 9:27 pm

Re: Next/Previous page button

Post by J0wNs »

balala wrote:To be honest I didn't understand what that issue is related to. Could you please describe it?
If you see in the video I linked, when I refresh all, the icons first overlap and then remain only the ones of the Page that's set.
However, there are two that remain overlapped until I press the button to change the page.
You can see it here: https://i.imgur.com/2EjmV9M.jpg
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next/Previous page button

Post by balala »

J0wNs wrote:If you see in the video I linked, when I refresh all, the icons first overlap and then remain only the ones of the Page that's set.
However, there are two that remain overlapped until I press the button to change the page.
You can see it here: https://i.imgur.com/2EjmV9M.jpg
Please check the involved codes to not have accidentally a typo somewhere.
Post Reply