Quite new to web - and there are probably more clever ways of doing what I need, but I thought the .parent property of webdialogs would be a useful starting point, but it always returns nil…
I have webdialog that appears on different pages and actions should vary depending on which page is the “parent”. I was optimistic when I saw that webdialogs have a .parent as webview property and I perhaps naively thought this would give info on parent page, but it seems not, because it’s always nil…
There are probably errors on multiple levels (excuse my ignorance!), but putting a button on a webdialog with the code:
MessageBox(self.Parent.Page.Name)
causes a NilObjectException and inspecting the webdialog properties, webdialog.parent = nil.
Not sure I understand how parent should be used?
Many thanks
Stam
It’s used by controls on a page to determine the parent. It works fine for controls. WebDialog is a bit different, and probably has the property as a result of subclassing. It probably could be implemented, file a ticket.
Since the framework is broken, you could very easily pass your own reference in when creating the WebDialog instance. That is the way it’s been done for years before that property existed.
should I have this as a property of the page instead and just instantiate with ‘new’? Or is there some way to assign as a child of the page on instantiation?
Sorry to display my ignorance here - I am probably misunderstanding you.
What I did test: I created a property in the parent web page of type the webdialog to show (lets call it myWebDialog) in the IDE. When launching the webdialog:
myDialog = new myWebDialog
myDialog.show
This doesn’t set the parent property of myWebDialog, which remains nil, so I presume I’m not doing what is recommended.
I also presume that this is an actual bug, as the .parent property seems pointless for webdialogs.
As @Greg_O suggests, I’ll just set a property of the webdialog on call it I guess…