Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started 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
-
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
-
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
-
you need 3 toggle buttons. Set the state of the other two after the press of the other.
-
How can I do that?
-
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.
-
Thanks for the reply. I tried your suggestion but got the error shown in the attachment.
-
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
-
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.
-
scr.SetProperty not scr.setProperty
-
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.