It is currently April 26th, 2024, 11:43 am

ImageButton issue

Get help with creating, editing & fixing problems with skins
User avatar
ShadowDragon
Posts: 44
Joined: January 28th, 2021, 4:30 pm

ImageButton issue

Post by ShadowDragon »

While learning the RainMeter, I made the base design working, but still needs some polishing in order to work
smoothly and perfectly, but I got 1 issue with alot of testing and errors everytime, once working, this issue is something
I cannot solve or if there is EVEN a solution for it.

This is only a slight part of the code, but while the side buttons has similair issue, it can be resolved together anyway.
MainStart uses the meter BUTTON and BUTTON Image, while pressing it, normal, hover works, but while it "HIDE" the button,
the press is not showed before it become active on mouse release.

but when active, the opacity of button = 0, but when I click it, it become 255, and when holding and move the mouse,
the "OnClick" image is shown.

Is there a to show on click before it become active? the "LeftMouseUpAction" has a different issue.
When using that part, it shows the OnClick button, but when holding it down and move the mouse off, and want to user
it, is shows the OnClick button instead of the hover (this stays after 2-3x after re-hover the button to get the correct one.

any solution for this problem? (the mouse down is there so it cannot move the menu.

Code: Select all

[MainStartMenu]
Meter = BUTTON
ButtonImage = #MainMenuButton#
ImageAlpha = #MainAlpha#
X = 785
Y = 175
DynamicVariables = 1
LeftMouseDownAction = #OCMM# [!SetVariable "MainAlpha" "0"] [!UpdateMeter MainStartMenu] [!ShowMeter "ActiveMainMenu"] [!Redraw]

[ActiveMainMenu]
Meter = IMAGE
ImageName = #MainMenuButtonA#
X = 785
Y = 175
Hidden = 1
DynamicVariables = 1
LeftMouseDownAction = #OCMM# [!SetVariable "MainAlpha" "255"] [!UpdateMeter MainStartMenu] [!HideMeter "ActiveMainMenu"] [!Redraw]
(PS: My Variables is a long list, so this is a seperate file) but it has the Button Images and execution of the for the apps)
so I dont think that is relevant?
Last edited by ShadowDragon on February 6th, 2021, 7:50 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ImageButton issue

Post by balala »

Since not after a day you still didn't get reply, I suppose I can say no one understood your problem / question. Me definitely didn't. So, if still interested, please reformulate the question.
User avatar
ShadowDragon
Posts: 44
Joined: January 28th, 2021, 4:30 pm

Re: ImageButton issue

Post by ShadowDragon »

I hoped the question to be clear enough?

the meter with BUTTON shows the state Hover, but when "leftMouseDownAction" it doesn't show the OnClick.

in this state: NORMAL : On CLICK : HOVER

while this is required by rainmeter to be readed as a button.

When I do LeftMouseUpAction, the image stays orange, when hover OFF, but also move the menu I build.
but when staying there, it shows the OnClick image when you "re-hover" the state, when off and ON again, it's
still OnClick, when 3rd time hover, it shows the hover state.

Why does teh mouse DOWN action don't show the OnClick button?

if I remove the dynamic variable, the meter with IMAGE shows the image, but also the BUTTON image.
I need the dynamic one, mouseDownAction seems most usefull, but it ignores the "pressed" image.

If I remove !UpdateMeter part, the button and variable doesn't even work at all. while I got the Redraw function as well on that part.
but I got no clue how to fix button to state as normal (works), hover (works), OnClick (pressed state (DOES NOT WORK).
but goes instantly to the Active Image part.

when clicking that image, it reversed to the BUTTOM PRESSED state first and on release to normal while the mouse is on HOVER
but become hover state when moving the mouse while on this button.

so what is the best way to fix this state? of if not, I have to live with this issue.
derLeon
Posts: 13
Joined: April 19th, 2019, 4:38 pm

Re: ImageButton issue

Post by derLeon »

Is this what you want?

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Variables]
;Grey is default
ColorOnDefault=127,127,127,255
;Red if MiddleDown
ColorOnMiddleClick=255,0,0,255
;Green if Hover
ColorOnHover=0,255,0,255
;Blue if MouseDown
ColorOnMouseDown=0,0,255,255
;Changeable Variables
SkinColor=#ColorOnDefault#

[MeterDebug]
DynamicVariables=1
Meter=String
Text=ABC
SolidColor=#SkinColor#
FontColor=255,255,255,255
FontSize=30
LeftMouseDownAction=[!SetVariable SkinColor #ColorOnMouseDown#][!Update]
LeftMouseUpAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]
MiddleMouseDownAction=[!SetVariable SkinColor #ColorOnMiddleClick#][!Update]
MiddleMouseUpAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]
MouseOverAction=[!SetVariable SkinColor #ColorOnHover#][!Update]
MouseLeaveAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]

note: yes. the LeftMouseDownAction disables Skin drag


you could DisableMouseAction with a seperate button
User avatar
ShadowDragon
Posts: 44
Joined: January 28th, 2021, 4:30 pm

Re: ImageButton issue

Post by ShadowDragon »

derLeon wrote: February 5th, 2021, 3:00 am Is this what you want?

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Variables]
;Grey is default
ColorOnDefault=127,127,127,255
;Red if MiddleDown
ColorOnMiddleClick=255,0,0,255
;Green if Hover
ColorOnHover=0,255,0,255
;Blue if MouseDown
ColorOnMouseDown=0,0,255,255
;Changeable Variables
SkinColor=#ColorOnDefault#

[MeterDebug]
DynamicVariables=1
Meter=String
Text=ABC
SolidColor=#SkinColor#
FontColor=255,255,255,255
FontSize=30
LeftMouseDownAction=[!SetVariable SkinColor #ColorOnMouseDown#][!Update]
LeftMouseUpAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]
MiddleMouseDownAction=[!SetVariable SkinColor #ColorOnMiddleClick#][!Update]
MiddleMouseUpAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]
MouseOverAction=[!SetVariable SkinColor #ColorOnHover#][!Update]
MouseLeaveAction=[!SetVariable SkinColor #ColorOnDefault#][!Update]
1) I dont know what DynamicSize eacly does atm, and the menu update = on -1 (because it update on click on, so
it doesn't have to update constantly this way.

2) while you use color, this require IMAGES so, you solution wont work this way.

3) meter = BUTTON and the button Name, the onClick doesn't work, but goes instantly to
meter = Image (active), while this works, the button PRESS should show first in this case,
while on active -> to button when you click on it, it does show the press state which is also weird!.

so your solution wont work on the image side.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ImageButton issue

Post by balala »

ShadowDragon wrote: February 5th, 2021, 4:21 pm 1) I dont know what DynamicSize eacly does atm, and the menu update = on -1 (because it update on click on, so
it doesn't have to update constantly this way.
That option is not DynamicSize, but DynamicWindowSize. If you set it to 1, the size of the skin is changing while the skin is running, to fit all meters, all the time.
ShadowDragon wrote: February 5th, 2021, 4:21 pm 2) while you use color, this require IMAGES so, you solution wont work this way.
Similarly you can set images instead of setting colors. We (nor derLeon, nor me) don't have your images, so we simply can't use them. Probably that's why derLeon set colors to the SkinColor variable, then used this variable into the SolidColor option, just to show you the way in which a variable can be used. To modify this you have to modify the values used into the !SetVariable bangs to the names of the images and use the set variable into the appropriate option (ImageName) of the Image meter.
ShadowDragon wrote: February 5th, 2021, 4:21 pm 3) meter = BUTTON and the button Name, the onClick doesn't work, but goes instantly to
meter = Image (active), while this works, the button PRESS should show first in this case,
while on active -> to button when you click on it, it does show the press state which is also weird!.

so your solution wont work on the image side.
I'm really sorry, but I still can't exactly follow what would you like to do, so can't give you an advice. Sorry...
User avatar
ShadowDragon
Posts: 44
Joined: January 28th, 2021, 4:30 pm

Re: ImageButton issue

Post by ShadowDragon »

balala wrote: February 5th, 2021, 5:31 pm Similarly you can set images instead of setting colors. We (nor derLeon, nor me) don't have your images, so we simply can't use them.
While you could do any custom button image (normal, onClick, hover) and a custom image of the same size.

but after searching a lot more, I found something on "[!Delay x]", now when I use it as this:

[Variables]
OCMM = "[!Delay "150"] [Togglings code here] (it's a bit long, for meters + hiding groups

the Delay seems to show the onClick state for 150 milisecons and open up after that automatically when "LeftMouseDownAction".
while without, you dont see it.

150 might be low, but 200-250 is a much of delay because of 1/4 seconds if you need a small click.
sometimes it flicker back to normal (while on hover state), it opens up, but the onClick state is visible when clicking it which is good.

but it took me a couple of days and some hours in order to find about !Delay x, why wasn't anything about that in the documentation?
some says, you can use delay x, toggle, delay x, toggle etc if it's in 1 variable.

but for now, the Delay action added seems to work, not smoothly though, but it works.

while it's not the ideal solution probably, if there is a smoother way, I still love to hear it, if not, I will be happy on this "Delay"
option that I added.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ImageButton issue

Post by jsmorley »

User avatar
ShadowDragon
Posts: 44
Joined: January 28th, 2021, 4:30 pm

Re: ImageButton issue

Post by ShadowDragon »

there is a final question, while I use "LeftMouseDownAction", the delay for toggle and hide the groups entirely works,
not perfect though, but when I add "[!Delay x]" in a group like: #L1# [!Delay "150"] [!ShowGroup "L1"] the button image
does not work anymore, and doesn't open the menu, when using "[!Delay "150"]" (with outside quoutes) does not respond
or not anymore on the alpha setting.

is there a way to add in the [RainMeter] section like:
LeftMouseDownAction = [!Delay 150]

so it will always has a 150 miliseconds delay on mouse down? or similair?
that would be really helpfull if this does work.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ImageButton issue

Post by balala »

ShadowDragon wrote: February 5th, 2021, 7:52 pm there is a final question, while I use "LeftMouseDownAction", the delay for toggle and hide the groups entirely works,
not perfect though, but when I add "[!Delay x]" in a group like: #L1# [!Delay "150"] [!ShowGroup "L1"] the button image
does not work anymore, and doesn't open the menu,
In an expression like #L1# [!Delay "150"] [!ShowGroup "L1"] first is executed #L1# (whatever is it, but it definitely should be bangs), then due to the following [!Delay "150"] bang Rainmeter waits for 150 millisecond and finally it executes the [!ShowGroup "L1"] bang. What do you mean by "the button image does not work anymore,"?
ShadowDragon wrote: February 5th, 2021, 7:52 pm when using "[!Delay "150"]" (with outside quoutes) does not respond
or not anymore on the alpha setting.
Do you mean you've added the above !Delay bang with quotes into an option (a LeftMouseDownAction option for instance)? If you did, it's wrong, don't quote the whole bang, it's not needed.
ShadowDragon wrote: February 5th, 2021, 7:52 pm is there a way to add in the [RainMeter] section like:
LeftMouseDownAction = [!Delay 150]

so it will always has a 150 miliseconds delay on mouse down? or similair?
that would be really helpfull if this does work.
It can be simply added, but makes no sense at all. Using just a !Delay bang is useless, because this bang is used to delay the execution of bangs following the !Delay bang. If there are no bangs after !Delay, what to delay?