Jump to content

Activate "Message Box" from Ladder


Recommended Posts

Hi, even on programming languages like c# it's incorrect to show a view from code (for example a messagebox).

Message boxes are usually required for a user input, and are in most cases 'code blocking' (The next command will not executed until the message box is closed, since it is waiting for a dialog result).


In UniLogic, message boxes are shown in a response to a user interaction (clicks, for example), and the result of the user interacting with the message box is clicking on one of the buttons (OK/Cancel/Yes/No) is executing 1 or more actions defined by the programmer. 

This is the correct way or writing UI.



I don't know the reason you want to show a message box, but for example, you want to show a message box like: "Temperature is over 80 deg), and you want to call it from Ladder.

In that case, I would choose Alarm for several reasons;

* Not blocking UI and annoys the user

* What happens if the deg reaches 81 and then falls back to 70 and then again reaches 81? Should another messagebox open while an active one is already opened?

* If the message box is designed to set a big when the OK is clicked, and the calling function is no longer running, what would you expect to happen?



We do want our user to keep a separation of UI from logic (You won't see any "Load Screen" elements in Ladder, but we do give a Load Screen global action which can be triggered from a bit).


A workaround for what you want is to have an overlay of something that looks like a message box with the texts and buttons that you want, and control it's visibility with a bit. (You can also design it as a custom control, so you will only need to set the visibility bit once, on the entire instance of the custom control)

Another workaround is to design the whole message box as a screen, and load the screen when the bit is set (the global action will automatically reset the bit), and when done, use "Last Screen" action on the clicked button in order to return to the original screen.






  • Upvote 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.