Probably best with a WebSDK control. I haven’t built a Web2 control in a while, I don’t know whether the visual or non-visual framework would work better for your use case.
problem is there is no visual item in xojo, only a call with parameters
and there is a visual item in the browser, so I don’t know if I should use a visual or non visual websdk control !
Var dialog As New WebMessageDialog
dialog.Title = "Modal Header"
dialog.Explanation = "Some text in the modal."
dialog.CancelButton.Caption = "Close"
dialog.CancelButton.Visible = True
dialog.ActionButton.Visible = False
dialog.Show
@Ricardo_Cruz_Fernandez nice catch.
but how do you get the button that is clicked if you have many ?
I mean , still creating the webmessagedialog on the fly like this, not creating a webdialog and embed it in a webpage.
I would still like to make it in html+java, because I would like to add some html in the explanation zone.
If you still want to show some HTML instead of a plain message, you could wrap the “Explanation” property between “raw” special tag, so Xojo won’t escape it:
Var dialog As New WebMessageDialog
dialog.Title = "Modal Header"
dialog.Explanation = "<raw>Some text <strong>in the modal</strong>.</raw>"
dialog.CancelButton.Caption = "Close"
dialog.CancelButton.Visible = True
dialog.ActionButton.Visible = False
dialog.Show
well, after a night of sleep (and thinkings) I really need to wait for the user to answer.
it’s a button, to delete a record
I ask the user “do you want to really delete this(these) record(s)”
and I have to wait for its answer to do it
how can I achieve that, in a simple “desktop” way , but with a webapp ?
if myConfirm("really delete the record(s)?") then
...do stuff...
else
... user canceled ...
end if
Operating modally as we understand from desktop is a bad idea in Web. The way to implement this is to cover the page with an element that behaves as a blocking mechanism to prevent the user from performing any actions until they have answered the modal message. When they click a button, you send the data back to the server then dismiss the dialog and blocking element.
some questions like “do you really want to delete xxx records” really needs the user to be focused on one task only … so I assume the modal behavior completely for this kind of task.
now the real question: is it feasible in xojo ? with a websdk or webmessage subclass or executejavascript ? what is the easiest way to do this ?
if we stay under bootstrap, there are classes already designed for a modal action
I just don’t know how to implement them in xojo …
Yes, it is possible in the way I describe above. I do it with GraffitiAlert and other specific implementations. The blocking element prevents the user from doing anything until they click a button, the data gets back to the server, and you do whatever needs to be done and dismiss the alert.
You should use the WebSDK as already directed by @Tim_Parnell above.