Hello,
I was having this problem but I resolved it after much trial and error.
I have a tab on a window and I wanted each user object tabpage within the tab to refer to a windows function. I have several user object datawindows on each tabpage and I want them all to have the same data and properties so I use the window to keep them in synch.
To do that, each tab page declares and instance variable of that that window object. When I open the window, I set the instance variables for each tab page to "this", for example
tab_1.tabpage_1.i_parentwindow = this
tab_1.tabpage_2.i_parentwindow = this
......
The tabpages can refer to i_parentwindow to communicate with each other.
My problems started when I started doing this. I could not edit the source for any user object tab page and save it - and worse, the user object would get deleted no matter what I did, even if I declined to save it after getting the error. Sometimes I could and I thought I had it solved but the problem would always come back randomly.
Then I took out this instance variable and simply had the user objects refer to the window object rather than an instance variable. When I open the window, I open the Window object rather than declare an instance of it and open an instance. I can no longer open multiple instances of that window but I don't need to do that.
There is probably a more elegant way to accomplish what I want but this is now working well and without error.
With this approach, you do not utilize the default global window variable (w_xxxxx), which allows multiple instances of the window to exist, and you avoid the issue using the "this" pronoun.
The application has worked fine in production for the past few months where all the individual tab pages referenced the default global window variable (w_xxxxx) rather than opening an instance of this object and referencing the instance. I have never been completely OK with this approach, especially since this is the only window in the application that had to be referenced this way - because the tab pages all have datawindows that share the same data and properties - so I use the window to communicate between them.
So after a few months I looked at it again with a fresh mindset and the solution is amazingly simple. Each tab page declares a local window variable lw_xxxx of type w_xxxxx in the event script that needs to refer to these datawindows. Then in that script,
lw_xxxx = this.getparent().getparent()
Now I can refer to the datawindows in lw_xxxx as I need to AND I can open up multiple instances of that window if I want. No one will likely do that but they can if they want and this is now consistent with the rest of the application.
Thanks for giving me the idea of using getparent().
Steve