If mTest = True Then
AddHandler DisplayMsg.NotificationDismissedAfter, WebPage1.NotificationDismissedAfter
Else
AddHandler DisplayMsg.NotificationDismissedAfter, WebDialog1.NotificationDismissedAfter
End
I am getting this compile error:-
Error: Type "WebDialog1" has no member name "NotificationDismissedAfter"
I had already added “NotificationDismissedAfter” as method in WebDialog1 and had already set it as public. Why am I still getting this error?
If mTest = True Then
AddHandler DisplayMsg.NotificationDismissedAfter, AddressOf WebPage1.NotificationDismissedAfter
Else
AddHandler DisplayMsg.NotificationDismissedAfter, AddressOf WebDialog1.NotificationDismissedAfter
End
If your webpages have implicit instance, they are preloaded, so they already exist. If you switch off implicit instance, you will have to do the same as WebDialog.
Note that because webpages are preloaded, they display faster, but the drawback is someone can use the browser developer tools to access them.
If for instance you want to limit access to certain pages, for instance with an app that requires login, it is better to switch off implicit instance in the IDE for all WebPages.
Attached is the sample project for easy reference.
In the WebDialog1, lets say I have a WebTextField1 with values entered. When I invoked the delegate method,
Dim d As MethodCaller //delegate
Dim w As New WebDialog1
d = AddressOf w.Method1
d.Invoke
is there any ways to read the existing value of WebTextField1.Text? Currently, my WebApp is showing an empty Text String Value. Probably I think it is due to creating a “New” instance of WebDialog1. Is it possible to copy the contents from the existing WebDialog1?
At this point in time, I really have no idea how to get the existing value due to my limited knowledge. Your help is greatly appreciated again.
[quote=309787:@Michel Bujardet]If W <> nil then
w.Method1
Msgbox w.TextField1.Text
end if[/quote]
I am able to implement these codes in my WebApp
w = New WebDialog1
w.show
But I do not know where should I place your recommended codes in my rest of my WebApp.
If W <> nil then
w.Method1
Msgbox w.TextField1.Text
end if
I had tried placing the codes in the possible methods but I am still getting compilation errors. Attached is my revised project file and I hope that you may send me a fish for this time instead.
As you can see from my test project, WebDialog Button1 is calling the method directly and I can get the value TextField1.Text
But for WebDialog Button2, I Need to call a Module and display the value of TextField1.Text instead. Cos ultimately I will be converting the WebDialog to a subclass and I will not be able to call the method directly as each new Webdialog will be showing different textfields
Attached, Please see the updated project file again
[quote=309875:@Michel Bujardet]You don’t need a module for a subclass.
However, it is easy to convert a method for a module. All you have to do is to pass the Webdialog to it :
[code]Sub DisplayText(wd as WebDialog1)
Msgbox wd.TextArea&.Text
end sub[/code]
And you would call it as such :
DisplayText(W)
or DisplayText(self) 'if from the Webdialog
In Subclasses methods are automatically exposed to the instance if you make them public. So Method1 is automatically available in w.
Could you try to describe what you want to do as a subclass ?
Please explain more fully.[/quote]
This is actually what I am trying to accomplished. I had converted my webdialog to a subclass (I do not know whether I had called it correctly or not). I think calling a method directly within the webdialog would not be possible(I hope that I am wrong) :(.
This is the revised project to give you my exact idea.link text
when save button is clicked, I am unable to save the record correctly as the textfield1.value is empty.
Webdialogs, WebPages, and in desktop Dialogs and windows cannot be subclassed.
You are wrong. You are actually calling the method from the webdialog in your previous project. A method can primarily be called from its class, and from other places if it is public. Protected is kind of public, but you have to call it from outside with the name of the instance as prefix :
w.Method1[quote=309878:@Alvin Lim]when save button is clicked, I am unable to save the record correctly as the textfield1.value is empty.
[/quote]
I don’t see any button on your WebDialog, but if it were on it, I believe it should work.
Your DisplayText method should be :
Public Sub DisplayText()
Msgbox TextField1.Text
End Sub
You don’t prefix calls when the method is on the class.
[quote=309881:@Michel Bujardet]Webdialogs, WebPages, and in desktop Dialogs and windows cannot be subclassed.
You are wrong. You are actually calling the method from the webdialog in your previous project. A method can primarily be called from its class, and from other places if it is public. Protected is kind of public, but you have to call it from outside with the name of the instance as prefix :
w.Method1
I don’t see any button on your WebDialog, but if it were on it, I believe it should work.
Your DisplayText method should be :
Public Sub DisplayText()
Msgbox TextField1.Text
End Sub
You don’t prefix calls when the method is on the class.[/quote]
The Save button is in the MainframeDialog. The WebDialog1 is subclass from MainframeDialog. I had make the method public in WebDialog1, but I am still getting an empty value when calling the method.
Hello Michel, after reading your reply again, it seems that you are still referring to my old project. Please see this project It should give you the idea of what I am trying to accomplish.
You should be able to see the save button in MainframeDialog and I did not call the method directly from webdialog1.