It is currently April 20th, 2024, 5:14 am

Custom 3 Part Button?

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Custom 3 Part Button?

Post by jsmorley »

kyriakos876 wrote: December 12th, 2018, 7:05 pm does it matter if they clickable area is a bit bigger than the image that represents the button? Like padding... I think It might even be better to have a bit more clickable area so that the user doesn't have to move themouse EXACTLY on the a button. But yea.... as you said very correctly:
Yes. While you won't get it "perfect", as any meter is always and must be a rectangle in shape, and you do NOT want any overlap of the meters in this, you could tweak it to be a bit less "jumpy".

What he might consider is not using MouseLeaveAction on each meter, but only changing the color(s) with MouseOver / LeftMouseDown actions, and have the only MouseLeaveAction be on some background image that encompasses all of them. Still not "perfect", but maybe "better". That's a judgment call he has to make. The choice is between changes that are perhaps "too often" or changes that are perhaps "not often enough".

It's why I suggested that maybe it makes more sense for only the section that is being interacted with change color. That makes the whole thing feel more sensible to me, and eliminates this "jumpy" effect.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Custom 3 Part Button?

Post by kyriakos876 »

Completely agree with that
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Custom 3 Part Button?

Post by jminternelia »

jsmorley wrote: December 12th, 2018, 6:53 pm Also, yeah... This is a bit weird to me, as it is not obvious what the change in colors signifies. Seem kinda arbitrary... ;-)
They don't really signify anything other than my own personal tastes. I've been loosely adapting the UI from the Oblivion movie for awhile now. Prior to this, where this button is was a rainmeter image "gif" with about 40 or so frames. To have "smoothish" animation on that required an obscenely low refresh rate, which caused it to be stuttery anyway. There were about 10 such "gifs" in the skin altogether. I know how you're a HUGE #1 FAN of every skin having dozens of performance eating animations, so sorry to disappoint you. :rofl: Slowly I am working on changing those out for more sensible static - but still interactive - stuff.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Custom 3 Part Button?

Post by jsmorley »

jminternelia wrote: December 13th, 2018, 2:35 pm They don't really signify anything other than my own personal tastes. I've been loosely adapting the UI from the Oblivion movie for awhile now. Prior to this, where this button is was a rainmeter image "gif" with about 40 or so frames. To have "smoothish" animation on that required an obscenely low refresh rate, which caused it to be stuttery anyway. There were about 10 such "gifs" in the skin altogether. I know how you're a HUGE #1 FAN of every skin having dozens of performance eating animations, so sorry to disappoint you. :rofl: Slowly I am working on changing those out for more sensible static - but still interactive - stuff.
:-) Hey, it's you that has to listen to the laboring CPU fan, not me...
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Custom 3 Part Button?

Post by jminternelia »

jsmorley wrote: December 13th, 2018, 2:45 pm :-) Hey, it's you that has to listen to the laboring CPU fan, not me...
https://forum.rainmeter.net/viewtopic.php?t=18823

I'm trying to figure out how to set up a toggle button and failing:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
ToggleVar=0

[IconToggle]
Meter=Image
ImageName=#@#Images\IconToggle.png
ImageFlip=
LeftMouseUpAction=["%USERPROFILE%\Documents\Rainmeter\Skins\X2ui\@Resources\HideDesktopIcons.exe"][!SetVariable ToggleVar (1-#ToggleVar#)][!WriteKeyValue Variables ToggleVar (1-#ToggleVar#)][!UpdateMeter *][!Redraw]
DynamicVariables=1
Text=ToggleVar = #ToggleVar#
W=36
X=16R
Y=16r
IfCondition=(#ToggleVar#=0)
IfTrueAction=[!SetOption IconToggle ImageFlip None][!Redraw]
IfCondition2=(#ToggleVar#=0)
IfCondition2=[!SetOption IconToggle ImageFlip Both][!Redraw]
I've tried several approaches. Something something syntax? IDK.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Custom 3 Part Button?

Post by balala »

jminternelia wrote: December 14th, 2018, 3:06 pm I've tried several approaches. Something something syntax? IDK.
Yep, there is one.
Take care that IfConditions can't be added to meters, they are working ONLY on measures. Move them to a measure. If you don't have one, just create it:

Code: Select all

[MeasureToggle]
Measure=Calc
Formula=#ToggleVar#
IfCondition=(#ToggleVar#=0)
IfTrueAction=[!SetOption IconToggle ImageFlip "None"][!Redraw]
IfCondition2=(#ToggleVar#=0)
IfCondition2=[!SetOption IconToggle ImageFlip "Both"][!Redraw]
DynamicVariables=1
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Custom 3 Part Button?

Post by jminternelia »

balala wrote: December 14th, 2018, 3:16 pm Yep, there is one.
Take care that IfConditions can't be added to meters, they are working ONLY on measures. Move them to a measure. If you don't have one, just create it:

Code: Select all

[MeasureToggle]
Measure=Calc
Formula=#ToggleVar#
IfCondition=(#ToggleVar#=0)
IfTrueAction=[!SetOption IconToggle ImageFlip "None"][!Redraw]
IfCondition2=(#ToggleVar#=1)
IfCondition2=[!SetOption IconToggle ImageFlip "Both"][!Redraw]
DynamicVariables=1
Hmm. Still can't get it to flip the image.

I fixed IfCondition2 also, since they both said =0. I tried this next:

Code: Select all

[MeasureToggle]
Measure=Calc
Formula=#ToggleVar#
IfCondition=(MeasureToggle=0)
IfTrueAction=[!SetOption IconToggle ImageFlip None][!Redraw]
IfCondition2=(MeasureToggle=1)
IfCondition2=[!SetOption IconToggle ImageFlip Vertical][!ReDraw!]
DynamicVariables=1
No Dice.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Custom 3 Part Button?

Post by balala »

jminternelia wrote: December 14th, 2018, 3:23 pm Hmm. Still can't get it to flip the image.
There is one more detail: there is a Text=ToggleVar = #ToggleVar# option in the [IconToggle] meter, which is wrong, having two equalities into one single option. Beside this an Image meter doesn't have nor a Text, nor a ToggleVar option. Remove it:

Code: Select all

[IconToggle]
Meter=Image
ImageName=#@#Images\IconToggle.png
LeftMouseUpAction=["%USERPROFILE%\Documents\Rainmeter\Skins\X2ui\@Resources\HideDesktopIcons.exe"][!SetVariable ToggleVar "(1-#ToggleVar#)"][!WriteKeyValue Variables ToggleVar "(1-#ToggleVar#)"][!UpdateMeter *][!Redraw]
DynamicVariables=1
ImageFlip=#ToggleVar#
W=36
X=16R
Y=16r
I also would add some bangs to update the Image meter, whenever the value of ToggleVar changes:

Code: Select all

[MeasureToggle]
Measure=Calc
Formula=#ToggleVar#
IfCondition=(MeasureToggle=0)
IfTrueAction=[!SetOption IconToggle ImageFlip "None"][!UpdateMeter "IconToggle"][!Redraw]
IfCondition2=(MeasureToggle=1)
IfCondition2=[!SetOption IconToggle ImageFlip "Vertical"][!UpdateMeter "IconToggle"][!ReDraw!]
DynamicVariables=1
Note that beside this, I also added some quotations above.
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Custom 3 Part Button?

Post by jminternelia »

balala wrote: December 14th, 2018, 3:38 pm There is one more detail: there is a Text=ToggleVar = #ToggleVar# option in the [IconToggle] meter, which is wrong, having two equalities into one single option. Beside this an Image meter doesn't have nor a Text, nor a ToggleVar option. Remove it:

Code: Select all

[IconToggle]
Meter=Image
ImageName=#@#Images\IconToggle.png
LeftMouseUpAction=["%USERPROFILE%\Documents\Rainmeter\Skins\X2ui\@Resources\HideDesktopIcons.exe"][!SetVariable ToggleVar "(1-#ToggleVar#)"][!WriteKeyValue Variables ToggleVar "(1-#ToggleVar#)"][!UpdateMeter *][!Redraw]
DynamicVariables=1
ImageFlip=#ToggleVar#
W=36
X=16R
Y=16r
I also would add some bangs to update the Image meter, whenever the value of ToggleVar changes:

Code: Select all

[MeasureToggle]
Measure=Calc
Formula=#ToggleVar#
IfCondition=(MeasureToggle=0)
IfTrueAction=[!SetOption IconToggle ImageFlip "None"][!UpdateMeter "IconToggle"][!Redraw]
IfCondition2=(MeasureToggle=1)
IfCondition2=[!SetOption IconToggle ImageFlip "Vertical"][!UpdateMeter "IconToggle"][!ReDraw!]
DynamicVariables=1
Note that beside this, I also added some quotations above.
Ha.

I also realized that the IfCondition2 was missing an IfTrueAction2. That fixed it. Much thanks.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Custom 3 Part Button?

Post by balala »

And one more: remove the ImageFlip=#ToggleVar# option from the [IconToggle] meter, because the value of the ImageFlip option can be either None, Horizontal, Vertical or Both, but the ToggleVar variable is numeric. You don't need a such option on the [IconToggle] meter, because the option is set dynamically, by the !SetOption bangs.
jminternelia wrote: December 14th, 2018, 3:42 pm I also realized that the IfCondition2 was missing an IfTrueAction2. That fixed it. Much thanks.
Does it work?