I found another one for you to update... the
multilabel.
First off... here is the document reference:
linuxcnc.org/docs/html/hal/pyvcp.html#_multi_label
This is the example right from the page... it fails.
Code:
<multilabel>
<legends>["Label1" "Label2" "Label3" "Label4" "Label5" "Label6"]</legends>
<font>("Helvetica",20)</font>
<disable>False</disable>
</multilabel>
1) You need commas between the legends.
2) The document makes it sound like you send it a number and it reacts to that... not quite... I'll explain.
I created a multilable called "
my-multi-label" and found that when I looked up the pins while in
AXIS using the
HAL CONFIGURATION... what I actually found was...
- pyvcp.my-multi-label.legend0
- pyvcp.my-multi-label.legend2
- pyvcp.my-multi-label.legend1
So I needed to create THREE buttons, one tied to each state...
This worked perfectly... and I could select from the three states that I created.
Code:
<multilabel>
<legends>["ALPHA", "BRAVO", "CHARLIE"]</legends>
</multilabel>
But that wasn't enough... oh no... I had to push the envelope...
Could it handle color?
Text wrapping? (That would be cool huh?)
So... this is what I got... in my default panel blue too...
Code:
<multilabel>
<halpin>"my-multi-label"</halpin>
<wraplength>"250"</wraplength>
<justify>"left"</justify>
<legends>["ALPHA is the first legend and therefore the default to this whole experiment.", "BRAVO would naturally come next,of course it would.", "CHARLIE is the next line that should become active if I click the button."]</legends>
<bg>"#000000"</bg>
<fg>"#ffffff"</fg>
</multilabel>
<button>
<font>("Helvetica",8)</font>
<width>10</width>
<halpin>"BTN-ALPHA"</halpin>
<text>"ALPHA"</text>
<bg>"#005C94"</bg>
<fg>"#ffffff"</fg>
</button>
<button>
<font>("Helvetica",8)</font>
<width>10</width>
<halpin>"BTN-BRAVO"</halpin>
<text>"BRAVO"</text>
<bg>"#005C94"</bg>
<fg>"#ffffff"</fg>
</button>
<button>
<font>("Helvetica",8)</font>
<width>10</width>
<halpin>"BTN-CHARLIE"</halpin>
<text>"CHARLIE"</text>
<bg>"#005C94"</bg>
<fg>"#ffffff"</fg>
</button>
I tied these together in the
postgui file...
Code:
net ALPHA <= pyvcp.BTN-ALPHA
net ALPHA => pyvcp.my-multi-label.legend0
net BRAVO <= pyvcp.BTN-BRAVO
net BRAVO => pyvcp.my-multi-label.legend1
net CHARLIE <= pyvcp.BTN-CHARLIE
net CHARLIE => pyvcp.my-multi-label.legend2
And it all works... the colors, the wrapped text, everything.
NOTE:
The multilable will latch... it will stay in the last state you select... so clicking the button will set it, releasing the button has no effect... not until another button is pressed. (
Or it gets another signal by whatever means.)
So now... I'll see if I can't pass data from my G-Code to this label.. things like instructions... then when they click the button...
"WARNING - THE SPINDLE IS ABOUT TO START"
I hope you found this helpful.
Jerry