Communicating messages to user (like Msgbox)

Hello

Is it possible to communicate a message to the user without it executing the next line of code until they confirm with OK button?

Kind regards

The only way to do this is the alert function:

alert("Hit return to continue-")

It’s almost always the wrong solution. First, it’s ugly and its appearance cannot be changed.

Furthermore, it blocks the app from doing anything. Most modern web apps are doing more than one thing at a time. While they are interaction with the user, they are often also interacting with other websites.

What’s your use case?

ok thank you.

Whilst I am learning NSB AppStudio I always want to return information on most lines and not for it to jump through the code.

Real world programs would be designed with callbacks in mind.

thanks

If it’s for debugging, you might want to use the Chrome Debugger. It’s got breakpoints and stuff with will help. The console.log() function is also useful.

I needed this functionality so created a custom form for this with a message and OK button. An additional Cancel button can be used as well and variables set to determine which was selected. A SetInterval calls a function to test if the OK or Cancel button was selected and the the code I wanted to pause for is executed. The interval function tests the variable, initially set to off, and exits the function until it has something, like ok or cancel were pressed, then code clears the SetInterval and executes the code accordingly, allowing the program to continue.

Nice thing about this is you can customize this to your liking and reuse it anywhere, even in other apps if you export the form.

John

Thanks John. I managed to get that example working if I ever need it.

I can only get it working if the paused code is in a separate sub/function?

Kind regards
Malc

I can only get it working if the paused code is in a separate sub/function?

Right.