How to execute html+javascript code in web app?

My implementation is currently a WebSDKUIControl/XojoVisualControl for reasons I won’t get in to, but a new implementation should be WebSDKControl/XojoControl.

1 Like

I really would like not to have to drag-drop a class on a webpage to be able to ask a user a simple question with yes or no. if I use a xojocontrol, I will have to do this.
it’s really not as simple as in a desktop app a simple method that returns a boolean.

It can’t be exactly like Desktop. You need to just throw that idea away. Web is different, that’s the way it is. If a web app waited for a response like this, it could cause innumerable issues.

Not if it was a thread that waited for a (http/json or such) response internally and resumed after the response was received. Isn’t it so that the xojo web was completely threaded ? So theoretically xojo could have implemented such behaviour.

Sessions are threads, but if your session thread is waiting for a response then it won’t be responding to events in the browser. They could have Session threads that spawn threads to wait for actions, but that could cause other issues that cannot be foreseen.

I would prefer to implement something properly asynchronously than build a (probably hazardous) kludge to force the web paradigm to fit inside a desktop mindset.

Yeah practically you’d want to use the xojo event based way using the WebSDK.

You’d still be passing things around from one thread to another, ensuring enough time is yielded to each thread, maintaining and enforcing WebSessionContexts, and who knows what else you’d find as you implement it. It’s not practical when it should be implemented correctly…asynchronously.

I still think WebMessageDialog is enough for what you want @Jean-Yves_Pochez, just did a quick example:

3 Likes

It certainly should be, from what he’s described he wishes to achieve, and WebMessageDialog implements this exactly the way I’ve outlined and is common across web applications.

1 Like

your example works nicely for what I’ve asked here Ricardo, many thanks.
still if I have a web page with 10 questions to the user, I must embed 10 different webdialog on the webpage… it would be easy to ask 10 different questions by modifying one webdialog,
but it would be a pain to dispatch the buttonpressed event after the user clicked each answer.

1 Like

Try with this one, I’ve extended WebMessageDialog with an “Action” property this time, so it’s available on ButtonPressed event:

1 Like

PS: I’d rather prefer to add 500 WebMessageDialog to the page than touching a single line of Javascript :rofl: