04-21-2020 08:22 PM
Hi Everyone,
Question first, then background 🙂
In the CM&L example, is there a way to use a single button to start and stop the event rather than have two separate buttons? I have many devices to start and stop and would like to reduce the clutter on my front panel. One button that turns green with different text would be preferable, but I can't get that to work in this example.
So, I have inherited quite an old program that controls an underwater camera with many peripherals. The ten or so devices are read/written to using either UDP or VISA serial. The old program consists of a parallel while loop architecture and the main screen goes on forever...
I am starting from scratch and have started using the QMH template. More specifically I am using the Continuous Measurement and Logging example and am hoping I can expand on that by making a message handler for each device I have. The front panel is quite full though, with controls and displays for many devices.
Many thanks.
Karl
Solved! Go to Solution.
04-21-2020 11:55 PM
@KarlosAmigos wrote:
In the CM&L example, is there a way to use a single button to start and stop the event rather than have two separate buttons? I have many devices to start and stop and would like to reduce the clutter on my front panel. One button that turns green with different text would be preferable, but I can't get that to work in this example.
Yes there is. You can use the button boolean text to display the current action of the button which will tell the user the state of the device. At the beginning you set the boolean text to "Start" because the device is stopped. When user presses the button, you send a message to the UI Message Loop which holds the state of the device in it's shift register and based on that it will know what message to send to the Device Communication QML (start or stop). On both of these messages, the device will attempt to start or stop and send a message with the its state back to the UI Message Loop that will use a property node to change the boolean text to "Stop" if device successfully started. Same thing you can do with button colors unless your buttons are of system type.
I would use Actor Framework instead of CM&L
05-05-2020 11:48 PM
"a message to the UI Message Loop which holds the state of the device in it's shift register and based on that it will know what message to send to the Device Communication QML (start or stop)."
Thanks LucianM, that did the trick and a simple true/false case structure to choose the message string that needed to be sent. Much appreciated!