It is currently May 27th, 2020, 2:29 am

Button Longevity

Help with creating, editing & fixing problems with skins
Dar-Krusos
Posts: 2
Joined: July 9th, 2019, 10:21 am

Button Longevity

Post by Dar-Krusos »

Hi,

Is it possible to extend the duration of the on-click image of buttons? Would I have to use the mouse action functions instead?
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Button Longevity

Post by balala »

Dar-Krusos wrote:
May 12th, 2020, 1:08 pm
Is it possible to extend the duration of the on-click image of buttons? Would I have to use the mouse action functions instead?
Me personally didn't understand what you would like. Could you please detail a little bit?
Dar-Krusos
Posts: 2
Joined: July 9th, 2019, 10:21 am

Re: Button Longevity

Post by Dar-Krusos »

balala wrote:
May 12th, 2020, 5:48 pm
Me personally didn't understand what you would like. Could you please detail a little bit?
When using a Button meter, the image that appears upon clicking the button only lasts until the mouse is no longer pressed. This duration is very short, and I would like to know whether it is possible to extend the duration using a Button meter, or whether I would have to use mouse-leave/mouse-click functions instead.
User avatar
Mor3bane
Posts: 834
Joined: May 7th, 2016, 7:32 am

Re: Button Longevity

Post by Mor3bane »

A little experimentation would show if your described options would produce the effect you are looking for.

Me personally, like the mouse over/leave actions as they indicate when a mouse is over a button for as long as it is there.

Other things like action timercould be used for an effect that persists after the mouse leaves, for example.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it
mak_kawa
Posts: 644
Joined: December 30th, 2015, 9:47 am

Re: Button Longevity

Post by mak_kawa »

Hi Dar-Krusos

It seems to me that you are talking about the behavior of a specific button meter. Could you post code of the button meter and its button image?
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Button Longevity

Post by balala »

Dar-Krusos wrote:
May 13th, 2020, 2:56 am
When using a Button meter, the image that appears upon clicking the button only lasts until the mouse is no longer pressed. This duration is very short, and I would like to know whether it is possible to extend the duration using a Button meter, or whether I would have to use mouse-leave/mouse-click functions instead.
No, it's not with a Button meter. But the same behavior can be simulated if instead of Button meter you are using Image meter. You have to change the shown image with appropriately set !SetOption bangs, into the MouseOverAction, LeftMouseDownAction, LeftMouseUpAction and MouseLeaveAction options.
For instance let's say you have the following Button meter:

Code: Select all

[MeterMyButton]
Meter=Button
ButtonImage=#@#MyButton.png
ButtonCommand=["Notepad.exe"]
As you know, the MyButton.png image, used as the image of the button, has to have three regions: its left third is shown "normally" (when the mouse isn't hovered over the button), the center is shown when the button is clicked and finally the right third when you're hovering the mouse over the button:
The first frame corresponds to the normal state, the second to the clicked state, and the third to the hover state.
Divide the appropriate image into three same sized images and name them for instance MyButton1.png, MyButton2.png, respectively MyButton3.png.
Now replace the above Button meter with the following one:

Code: Select all

[MeterMyButton]
Meter=Image
ImageName=#@#MyButton1.png
MouseOverAction=[!SetOption #CURRENTSECTION# ImageName "#@#MyButton3.png"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageName "#@#MyButton1.png"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseDownAction=[!DisableMouseAction #CURRENTSECTION# "MouseLeaveAction"][!SetOption #CURRENTSECTION# ImageName "#@#MyButton2.png"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=["Notepad.exe"][!Delay "#Delay#"][!EnableMouseAction #CURRENTSECTION# "MouseLeaveAction"][!SetOption #CURRENTSECTION# ImageName "#@#MyButton1.png"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
For this to work you have to define the Delay variable into the [Variables] section of your code:

Code: Select all

[Variables]
Delay=1000
This is the amount of time which the button image is kept when you're clicking the button and is expressed into milliseconds.
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Button Longevity

Post by balala »

Mor3bane wrote:
May 13th, 2020, 7:31 am
Other things like action timercould be used for an effect that persists after the mouse leaves, for example.
Although possible, doesn't worth to complicate things with ActionTimer plugin measure(s), because it is a little bit more complicated to work with it than with, for example, the !Delay bang, which can properly deal with such tasks.