Label
- BigJohnT
- Topic Author
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
Is this possible?
Thanks
John
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
- Posts: 25
- Thank you received: 761
The answer is basically an event handler
www.linuxcnc.org/docview/devel/html/gui/...user_defined_actions
seems to cover it in respect of glade and there is even an example for changing label text based upon button presses.
This is the same way C/C++ gui programs work, pressing or checking something creates an event and handlers are written and linked to those events to perform the required actions.
emc2_2.5xxx/configs/gladevcp/complex also shows an example
Anything more detailed best ask Michael H, I am trying to keep away from python, lest I scramble what my brain still remembers of C/C++ !!
regards
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
I'm building my GladeVCP panel for the BP and I'm wondering if you can have a label that changes the text based on an input. For example if the spindle is off display OFF, if running in the forward direction display FWD, and if running in reverse display REV.
Is this possible?
Yes, it is.
The basic scheme is:
- define a HAL pin with halcomp.newpin()
- associate a 'value-changed' handler with that pin, which will be called when the HAL pin's value is changed
- in that handler, set the widget as appropriate,
I suggest you look at the configs/gladevcp/complex example, the example_trigge pin shows how to do it.
Let me know if it works out, otherwise I'll cook up an example
-Michael
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23310
- Thank you received: 4858
- associate a 'value-changed' handler with that pin, which will be called when the HAL pin's value is changed
- in that handler, set the widget as appropriate, l
Is there no standard widget that will do this? It sounds like a combo-box but in reverse, where an input integer chooses from a list of entries (whereas with a combo-box choosing an entry sets an integer output).
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 194
- Thank you received: 2
in your case if speed is 0 then label.in is 0 -> text is 'STOP' or whatelse.
label.in<0 -> text is 'REV'
label.in>0 -> text is 'FWD'.
Davide.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
git.mah.priv.at/gitweb/emc2-dev.git/shor...s/heads/custom-label
-Michael
Please Log in or Create an account to join the conversation.
- BigJohnT
- Topic Author
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
Thanks so much for the example... examples help a lot when your new and confused. I'll get this tried out this afternoon.
I'm really liking GladeVCP and have figured most things out by reading the manual.
Thanks
John
Please Log in or Create an account to join the conversation.
- BigJohnT
- Topic Author
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
Thanks so much! I tested it out stand alone and it will work well for my configuration.
Thanks
John
Please Log in or Create an account to join the conversation.
- BigJohnT
- Topic Author
- Offline
- Administrator
- Posts: 7106
- Thank you received: 1177
Thanks again! I got it working in my configuration and it is the neatest thing to see it... your example made the difference between many hours of pulling my hair out and getting it up and going in a hurry.
Thanks
John
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
git.mah.priv.at/gitweb/emc2-dev.git/shor...s/heads/custom-label
-m
Please Log in or Create an account to join the conversation.