I'm not entirely sure I follow what you are trying to do, or more particularly how you are trying to do it, but here is one approach I might use given an overall concept of:
Have a skin with buttons. The number of buttons that are displayed is driven by a variable in an @Include file. If that variable is "1" then one button is shown. If it is "3" then three buttons are shown.
Have a settings skin that displays that count of buttons (that variable in the include file) and allows you to use arrows to "step" through the numbers from 1 to XX (5 in my example). The arrows should have enough intelligence that the down arrow can't be used if the number is "1" and the up arrow can't be used if the number is 5.
So I have two skins and one include file:
1.jpg
ButtonBar\@Resources\ButtonCount.inc
ButtonBar.ini
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
@Include=#@#ButtonCount.inc
[MeasureShowButtons]
Measure=Calc
Formula=#ButtonCount#
OnUpdateAction=[!HideMeterGroup 5][!ShowMeterGroup #ButtonCount#][!UpdateMeter *][!Redraw]
UpdateDivider=-1
[MeterButton1]
Meter=Image
Group=1 | 2 | 3 | 4 | 5
W=30
H=30
SolidColor=157,245,167,255
LeftMouseUpAction=[!Log "Clicked Button1"]
[MeterButton2]
Meter=Image
Group=2 | 3 | 4 | 5
X=3R
W=30
H=30
SolidColor=157,245,167,255
LeftMouseUpAction=[!Log "Clicked Button2"]
[MeterButton3]
Meter=Image
Group=3 | 4 | 5
X=3R
W=30
H=30
SolidColor=157,245,167,255
LeftMouseUpAction=[!Log "Clicked Button3"]
[MeterButton4]
Meter=Image
Group=4 | 5
X=3R
W=30
H=30
SolidColor=157,245,167,255
LeftMouseUpAction=[!Log "Clicked Button4"]
[MeterButton5]
Meter=Image
Group=5
X=3R
W=30
H=30
SolidColor=157,245,167,255
LeftMouseUpAction=[!Log "Clicked Button5"]
The key to this skin is that when the skin is loaded or refreshed, it gets the value of that variable "ButtonCount" from the include file. It first hides all button meters, then shows the appropriate ones based on the value of that variable. If #ButtonCount# is 2, then the "Groups" 1 and 2 are shown. If #ButtonCount# is 4 then "Groups" 1, 2, 3 and 4 are shown.
Then we have our skin to set the count of buttons to show. We put that in a sub-folder of ButtonBar, so both skins can be loaded at once.
ButtonBar\ButtonSet\ButtonSet.ini
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
[Variables]
@Include=#@#ButtonCount.inc
[MeasureManage]
Measure=Calc
Formula=#ButtonCount# < 2 ? 1 : (#ButtonCount# > 4 ? 5 : #ButtonCount#)
IfCondition=MeasureManage < 2
IfTrueAction=[!SetOption MeterDown ImageTint "170,170,170,255"][!SetOption MeterUp ImageTint ""][!UpdateMeter *][!Redraw]
IfCondition2=MeasureManage > 4
IfTrueAction2=[!SetOption MeterUp ImageTint "170,170,170,255"][!SetOption MeterDown ImageTint ""][!UpdateMeter *][!Redraw]
IfCondition3=(MeasureManage > 1) && (MeasureManage < 5)
IfTrueAction3=[!SetOption MeterUp ImageTint ""][!SetOption MeterDown ImageTint ""][!UpdateMeter *][!Redraw]
IfConditionMode=1
DynamicVariables=1
UpdateDivider=-1
OnUpdateAction=[!SetVariable ButtonCount [MeasureManage]][!WriteKeyValue Variables ButtonCount [MeasureManage] "#@#ButtonCount.inc"][!Refresh "ButtonBar"]
[MeterUp]
Meter=Image
Group=Arrows
ImageName=#@#Images\ButtonArrow.jpg
X=1
AntiAlias=1
LeftMouseUpAction=[!SetVariable ButtonCount (#ButtonCount#+1)][!UpdateMeasure MeasureManage][!UpdateMeter *][!Redraw]
DynamicVariables=1
[MeterCountBox]
Meter=Image
ImageName=#@#Images\ButtonCount.jpg
X=0
Y=2R
AntiAlias=1
[MeterCountNumber]
Meter=String
MeasureName=MeasureManage
X=16
Y=21
FontSize=14
FontColor=0,0,0,255
StringAlign=Center
StringStyle=Bold
AntiAlias=1
[MeterDown]
Meter=Image
Group=Arrows
ImageName=#@#Images\ButtonArrow.jpg
ImageFlip=Vertical
X=1
Y=9R
AntiAlias=1
LeftMouseUpAction=[!SetVariable ButtonCount (#ButtonCount#-1)][!UpdateMeasure MeasureManage][!UpdateMeter *][!Redraw]
DynamicVariables=1
This is a little more complex, but simple enough in principle.
What we do is again get the value of the variable #ButtonCount# from that ButtonCount.inc include file.
Then, skipping that [MeasureMange] measure for a second (we will come back to it) we just have the meters that will display the "up" arrow, the "down" arrow, and a box with the "count" between them.
The arrow meters have a LeftMouseUpAction that either adds 1 to #ButtonCount# (up arrow) or subtracts 1 from #ButtonCount# (down arrow). They then use !UpdateMeasure to update our waiting [MeasureManage] measure.
So what [MeasureManage] does is:
1) Look at the current value of #ButtonCount#. If it is below 2, keep it at 1. Don't let it go below 1. If it is above 4, keep it at 5, don't let it go above 5.
Formula=#ButtonCount# < 2 ? 1 : (#ButtonCount# > 4 ? 5 : #ButtonCount#)
2) Check to see its own current value (which is also the current value of #ButtonCount#) is less than 2 (equal to 1 in other words). If so, use ImageTint to visibly "turn off" the down arrow meter, and "turn on" the up arrow meter.
3) Check to see its own current value (which is also the current value of #ButtonCount#) is greater than 4 (equal to 5 in other words). If so, use ImageTint to visibly "turn off" the up arrow meter, and "turn on" the down arrow meter.
4) If the current value is between 2 and 4 then use ImageTint to visibly "turn on" both arrow meters.
Then the meat and potatoes of the idea:
OnUpdateAction=[!SetVariable ButtonCount [MeasureManage]][!WriteKeyValue Variables ButtonCount [MeasureManage] "#@#ButtonCount.inc"][!Refresh "ButtonBar"]
When the measure is updated, we set the variable #ButtonCount# to the current value of the measure, write the value to our ButtonCount.inc include file, and remotely refresh our ButtonBar skin. That skin will then display our changed number of buttons.
ButtonBar.gif
This requires the latest 3.1 beta of Rainmeter from
http://rainmeter.net.
ButtonBar_1.0.rmskin
You do not have the required permissions to view the files attached to this post.