Hello Guest it is November 29, 2022, 08:38:21 PM

Author Topic: Unpress screen button with other buton  (Read 1366 times)

0 Members and 1 Guest are viewing this topic.

Unpress screen button with other buton
« on: October 21, 2019, 12:58:18 PM »
Dear people,

Iam currentlyy building a custom function in a tab on screen to quickly do so programmed gcode. I have 3 different ''option'' buttons on screen. But only one can be pressed down and the other needs to be up.

How do I make the screen buttons go up when one of the other two is presses? I couldn't find it anywhere.

Could someone please help me? Thanks in advance.

Kind regards,
Jelle
Re: Unpress screen button with other buton
« Reply #1 on: October 21, 2019, 02:31:16 PM »
I don't see a button state for regular buttons but I think you could use toggle buttons and on the left up script set the other button's buttonState to 'Up' or down depending on what you desire.

HTH

RT
Re: Unpress screen button with other buton
« Reply #2 on: October 21, 2019, 02:33:29 PM »
Thanks for the reply. I thought of that. But my screen needs three options. This is why I can't use the toggle button, cause it only has two options.

Thanks for the reply though
Re: Unpress screen button with other buton
« Reply #3 on: October 21, 2019, 02:34:40 PM »
you need 3 toggle buttons.  Set the state of the other two after the press of the other.
Re: Unpress screen button with other buton
« Reply #4 on: October 21, 2019, 02:36:39 PM »
How can I do that?
Re: Unpress screen button with other buton
« Reply #5 on: October 21, 2019, 02:46:51 PM »
tog1,tog2,tog3
in the left up script for tog1
scr.setProperty('tog2','Button State','Up')
scr.setProperty('tog3','Button State','Up')

see this example I posted a while ago
https://www.machsupport.com/forum/index.php?topic=36612.msg250977#msg250977

You could also just use regular buttons and change the 'Label' or 'Bg Color' property.
Re: Unpress screen button with other buton
« Reply #6 on: October 21, 2019, 03:03:05 PM »
Thanks for the reply. I tried your suggestion but got the error shown in the attachment.
Re: Unpress screen button with other buton
« Reply #7 on: October 21, 2019, 03:06:01 PM »
Without seeing the exact code you ran it is impossible to know what you did.  If you just copied the code and didn't create 3 toggle buttons and rename them tog1,tog2.... then of course it won't work
Re: Unpress screen button with other buton
« Reply #8 on: October 21, 2019, 03:09:29 PM »
I already had three toggle buttons which I gave names in the same order as you did. Volopdek, Tussenliggend and Halfopdek.
'
I put this code in the up script from button ''volopdek'': scr.setProperty('Halfopdek','Button State','Up') scr.setProperty('Tussenliggend','Button State','Up')

This is my first time trying to change screen related items in lua, so maybe I am doing something stupid here.
Re: Unpress screen button with other buton
« Reply #9 on: October 21, 2019, 03:16:48 PM »
scr.SetProperty not scr.setProperty