Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jelle_bos on October 21, 2019, 12:58:18 PM

Title: Unpress screen button with other buton
Post by: jelle_bos 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
Title: Re: Unpress screen button with other buton
Post by: rhtuttle 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
Title: Re: Unpress screen button with other buton
Post by: jelle_bos 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
Title: Re: Unpress screen button with other buton
Post by: rhtuttle 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.
Title: Re: Unpress screen button with other buton
Post by: jelle_bos on October 21, 2019, 02:36:39 PM
How can I do that?
Title: Re: Unpress screen button with other buton
Post by: rhtuttle 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 (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.
Title: Re: Unpress screen button with other buton
Post by: jelle_bos on October 21, 2019, 03:03:05 PM
Thanks for the reply. I tried your suggestion but got the error shown in the attachment.
Title: Re: Unpress screen button with other buton
Post by: rhtuttle 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
Title: Re: Unpress screen button with other buton
Post by: jelle_bos 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.
Title: Re: Unpress screen button with other buton
Post by: rhtuttle on October 21, 2019, 03:16:48 PM
scr.SetProperty not scr.setProperty
Title: Re: Unpress screen button with other buton
Post by: jelle_bos on October 21, 2019, 03:18:32 PM
Sorry about that just coppied it form your reply earlier.

Changed it to a capital letter and now it works. Thanks for all the help.