Issues with WebDialogs in the controller part of a page

Hi,

I have added a few WebDialogs in my app, and instead of of using

Dim WDial as New WebDialogX WDial.Show
I drag these WebDialogs on the WebPage they will be used. So far so good . . . Thing is the properties from the source WebDialog are not copied to the dragged component on the WebPage. Differences are in one or many of these properties:

  • source says Resizable off but it’s on in the dragged control
  • with and or height is/are different
  • type can be different

Why on the earth aren’t properties the same in the dragged WebDialog ? This is making the debugging such a pain.

Thanks

This is expected behavior. When you drag the object onto the webpage you’re creating an instance of it. Modify your instance, or create a new one if the changes to your super are drastic. Check out how subclassing works via the manual for more information.

@Tim Parnell

From Subclasses and Classes

Then why when dragging the WebDialog on the WebPage, the instantiated control does not get the properties of the superclass ?

Because an instance is not the same as a subclass.

The instance inherits the values of its class at the moment it was instantiated.

When you change the text of a textbox, all the rest of the textboxes should have the same text?

@Greg O’Lone I understand that instance is not a subclass.

If I go the way of Dim Obj As Some_Dialog ... the object is instantiated at this moment. If I stop the App, make changes to Some_Dialog, for example add a few text fields, the next time time I run Dim Obj As Some_Dialog ..., Obj will show the new objects added, or any other edit that was done.

Now if I drag Some_Dialog on a WebPage, this Dialog will be instantiated automatically without needing to add code. Now if I edit Some_Dialog and restart the app, it looks like the dragged automatically instantiated Dialog will be identical to was it was before, without the edits (changes are not carried over).

Then the question is: is the dragged Some_Dialog instantiated the same as with code, or is it a copy of Some_Dialog at a point in time ? This bring me to think it’s the latter:

From @Tim Parnell

Another way to put it: is the object instantiated the moment I drag it, or each time the WebPage is shown ?

It’s instantiated when you drag it on to the web page in the IDE. That moment is when the internal version of dim obj as some_dialog occurs. So, if you want those updated values you can update them manually or create a new instance by dragging a new one onto the webpage. The same kind of thing happens if you create a custom control.

I’m sorry if I wasn’t super clear, sometimes my end of the day posts can be kind of short. Does this help?

Wow, this is against logic. I really thought, at first, that the object was instantiated each time the Webpage was itself instantiated. Is that explained somewhere in the documentation ? I don’t recall it being mentioned in Videos. It’s so easy to forget to re-drag the super object after being edited.

So my today’s guess is confirmed. Amazing.

It looks like your logic is broken. The web dialog works the same as the other classes, the same as containers. Why it should be in the documentation a warning: “This class works the same as the others”?

You can get around this by calling your WebDialogs dynamically. This gets around the need to add it to a WebPage and pages will tend to load faster (since it doesn’t have the baggage of a dialog that might never be opened). You’ll have to use AddHandler for the DialogDismissed event but it’s not very hard to to.

At one point this could create some memory leaks but I’d imagine that has been fixed by now. You might want to check if this is still the case.

@Gilles Plante I find this hard to remember for some reason too. But it easy enough to work around by just creating a dialog on the fly.

Dim dlg as new my_diaolg
dlg.show

You will probably need to use AddHandler when you close the dialog.

Jay and Bob,

I will from now on create the dialog on the fly. I would have never thought the other would be a static instansiation - guess I need to read some more !

Why do I need to call AddHandler upon closing the dialog ?

I just place a Property on the WebPage (e.g., WebPage1.MyDialog As MyDialog). Then when I want an instance of MyDialog I do this:

WebPage1.MyDialog = New MyDialog WebPage1.MyDialog.Show

In MyDialog itself, its Dismissed event is just this:

WebPage1.MyDialog = Nil

This way I never need to deal with AddHandler.