Invoke same WebDialog from different WebPages

Hi all,
I am trying to do not use message boxes in my webapp projects and replace them with webdialogs (more control + better aspect).
To explain as simple as possible, I need to call the same webdialog from different webpages.
The webdialog has 2 bottons, one for closing itself and the other one to execute a method of the webpage from which the webdialog was invoked.
The method in the different webpages that would call the webdialog, has the same name.
I am not finding the right way to tell the webdialog from which webpage I am invoking it.
Probably is quite simple and I will apprecaite if someone could give a help on this.
I am including a link below to a simple project where you could see what I had tried to explain above.
https://www.dropbox.com/s/vx9tsia2l09xy4n/myDialogDemo.xojo_binary_project?dl=0
Thanks a lot.

Not sure if this is the best way to do what you want, but I use this method a lot. Here is some code from one of my projects. wdEditCell is a web dialog with a text field where the user can edit a value. I have a method called setPrice that is part of the page that handles the user input from the dialog once the dialog is closed.

dim wdSetPrice as new wdEditCell
AddHandler wdSetPrice.dismissed, AddressOf setPrice
wdSetPrice.Show

[quote=387680:@Mariano Poli]The method in the different webpages that would call the webdialog, has the same name.
I am not finding the right way to tell the webdialog from which webpage I am invoking it.
Probably is quite simple and I will apprecaite if someone could give a help on this.[/quote]

Add a webpage property to your webdialog, that you initiate at the time you display it with your webpage.

For instance myWP as WebPage

And when you need to display it

Dim wd as new Palette1 wd.myWP = self wg.show

I tried what you explain but without success.
Is quite similar to the project I attached.
@Michel Bujardet could you please be so gentle to change the example project I sent with you suggestions ???
Thanks

@Kevin Windham Thanks but I dind´t also have conditions to solve the problem with your method…

Mariano, your project works with only one modification. Here is the MouseDown event of the Call Webdialog button :

[code]Sub MouseDown(X As Integer, Y As Integer, Details As REALbasic.MouseEvent) Handles MouseDown
MyWebDialog_1.GenericWebPage = Self
MyWebDialog_1.Show

'How to tell the web dialog that the WebPage that is calling is MyWebPage
'in order to use the same WebDialog for different WebPages ?
'May be like this ???
'MyWebDialog_1.GenericWebPage = Self
End Sub[/code]

@Michel Bujardet the problem is that in the mousedown of the dialogbox I need to call GenericWebPage.myMethod… but wen I try to debug I receive the following error:
Type “WebPage” has no member named “myMethod”
GenericWebPage.myMethod

Strange. It works here. And indeed it should not, since WebPage does not have that method.

It would work if you do

GenericWebPage as WebPage1

And in the code that shows the dialog :

MyWebDialog_1.GenericWebPage = WebPage1(Self) MyWebDialog_1.Show

Basically, as long as each page has the same MyMethod, it will work since WebPage1(Self) means whatever page will be treated as Webpage1.

I didnt have conditions make it runs with the modifications you suggest
Could you please download the my expample project and upload another one that works with your modifications ?
https://www.dropbox.com/s/vx9tsia2l09xy4n/myDialogDemo.xojo_binary_project?dl=0
Thanks a lot @Michel Bujardet

Mariano, I am sorry but I rather not write code for you.

It is important you understand what is making it work.

A generic web page does have the method on it. So you need to set the genericwebpage property on the dialog as MyWebPage.

Then to assign self to that property, you need to cast it to MyWebPage, so it will be treated as such.

GenericWebPage as MyWebPage

Sub MouseDown(X As Integer, Y As Integer, Details As REALbasic.MouseEvent) Handles MouseDown MyWebDialog_1.GenericWebPage = MyWebPage(Self) MyWebDialog_1.Show End Sub

Thanks @Michel Bujardet
I didnt spect you write code for me… and I understand a logical forum policy to do not do that.
If people who spend their time answering questions, like you very getly do, also have to write code for each inquiry people placed in the forum, it would not be possible.
As I sent an example project of not more than 10 lines of code, where only a line or two have to be changed in order to work fine, I supposed that it would take less of your time in order to answer, without having to write a hole explanation.
I really appreciate all of your answers and I think you are one of the most active participants of the forum, always with intelligent and practical answers.

Finally I found a solution to the problem, in my personal way (probably not the best one but works).
If this solution could be usefull for anyone, please use it. Below is the solution link:
https://www.dropbox.com/s/vx9tsia2l09xy4n/myDialogDemo.xojo_binary_project?dl=0
Nothing super cool but, in order to avoid the not so beatifull message boxes, it could be a solution where each one could give the webdialog the look and feel that each one likes and not be restricted to the limitations of then common message box style.

Mariano, may I simply point that you had the solution in my last post, where I took the time to explain how and why it worked.

You just had to edit TWO lines.

Sometimes, it pays to learn.

Muchel,
Learning is always not free (or must be).
The solution as you see was not using what you suggested.
Probably your solution is better. Mine works fine.
Thanks again.

Whatever. Why do you ask for assistance to then ignore help ?

Next time I will simply abstain. After all, I don’t need that kind of worthless posts.

You do exactly what is needed to discourage anybody to help.

@Michel Bujardet … You misunderstood my response, may be for my limited english.

I didn’t ignore what you suggested… I dind’t have condition to apply, and I continue trying for a solution by my own.
Thats why I asked you to include your suggestions in the example code, not to work free for me, but because of my limited experience with Xojo I couldn’t solve with your only explanation.

Please do not abstain…
As I said in earlier posts: “I really appreciate all of your answers and I think you are one of the most active participants of the forum, always with intelligent and practical answers.”

Thanks again and sorry if something I said was misunderstood.