I have a window that is used for adding records and then doing a calculation when the record is saved. I’ve created a conversion routine to bring in data from an older version of the application and it instantiates the window and the populates it with data and then calls methods in the window to save it, which causes the data to be calculated.
The problem is when it is completely done converting the data, the window popups up with nothing in it and it is sitting on top of the window that calls the conversion routine.
When I instantiate the window, I’m changing it to hidden so it doesn’t show being populated. At the end of the routine, I’m issuing a window.close to close it but it continues to popup up.
Any suggestions to remedy this.
BTW, I have to use the window because all the calculation methods are in the window and moving these to a module would be very difficult.
The Window is not a class and I’ve tried making a copy of it and turning implicit installation OFF and it still shows up after processing using it.
Would it make a difference that it’s being instantiated in a window that is a document window?
There’s nothing in the open event. Even if I just do:
wHome (this is the main window with the main toolbar on it)
if UpdateLoans then
'— CALLS A METHOD IN A MODULE TO DO THE FOLLOWING
var wAmort2 As New Amort
… populate form with data needed to calculate and then ( I commented all this for testing)
wAmort2 = nil
end
'— WHEN IT RETURNS FROM THE MODULE THE WINDOW POPUPS UP
You mean after using it and then hiding it? We had this recently (I had the problem too). If you access any property of the window while it is hidden, you’ll make it visible.
It can happen if you access any control on the window
So for example, if you have a listbox and you access mylist.list(mylist.listindex)
To avoid that , create a global property on the window
var listresult as string
then set listresult = (some value from a control) as the controls are used while the window is visible
You can safely access listresult from a non-visible window without making it become visible again.
The OP would have to turn implicit instance off on every single window in the project. It isn’t enough to turn it off on the main window. Every window you add to a project has implicit instance True by default.
We are using a Window class as our default for all windows and so turning off Implicit Instance in the Window probably doesn’t do any good and, in fact, did not seem to make any difference.
I’m suspecting that there may be something in our class that is causing this to happen, but we did find a suitable workaround. When processing is completed, we run this close to close any open instances of the window.
for x as Integer = WindowCount DownTo 0
if Window(x) isa wAmort then
Window(x).Close
end
next