IoannisBal Posted April 26, 2014 Share Posted April 26, 2014 I have a PID controller and I need to create a button that starts/stops the controller and in addition it has to show the word start when it is activated and stop when it is deactivated The same thing has to be done with a button that starts/stops a sequence. kind regards Link to comment Share on other sites More sharing options...
AzeoTech Posted April 27, 2014 Share Posted April 27, 2014 Yes, it can be done. However, it is, in my opinion and I'm guessing most others, a bad idea to use a single button as a toggle, especially if the label is used to indicate the state. There is a reason many things from table saws to other industrial equipment come with a separate push button for on and off. Here are the two reasons I say this: 1) especially on a computer screen, it is easy to accidently double click. This results in whatever turning on then immediately turning off 2) and this is the important one, and a well known user interface no-no even for non-industrial UI's: Switching the text on a button based on a toggle is very confusing. Let's say the two labels are "Run" and "Stop". Well, when its labelled "Run" does that mean that clicking the button will Run the system, or does that mean that the system is already running? That said, you want a quick sequence. For a sequence called "test" it would be: if (sequence.test.running) endseq(test) strCaption = "Start" else beginseq(test) strCaption = "Stop" endif For a PID loop, its basically the same, just change sequence to PID, and "seq" to PID as well. This is for a button component. Make sure you save in Stop mode, otherwise the label will be wrong. You can init the label by giving the button component a name, then in an auto-start sequence putting: component.myButton.strCaption = "Start" Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.