I’m working on a new tool that will allow multiple instances of itself via a “File” -> “New Task” menu item. When a new task is started, a new instance of the main window is opened and once the task is defined, a new process monitor window is opened with the parent task window being hidden. The app could support up to 10 simultaneous instances, and therefore have 10 logical children assigned for the tasks. I need the child windows to be able to communicate back to its parent window to unhide and update the summary fields when the task completes.
Another project that opens multiple children from a single main window is easy to deal with since they all feed back into the main.
Ideas? An Array of Windows? An array of classes that track the Windows? Just scratching my head on this on logically.
At any given time, only one of the pair is active/visible. It seems like ProcessMonitorWindow simply needs a reference to its MainWindow. It doesn’t need to know about any other windows. I think a simple reference, ParentWindow as MainWindow, would be sufficient.
[quote=269670:@Tim Hare]So you have up to 10 pairs of
MainWindow <—> ProcessMonitorWindow
At any given time, only one of the pair is active/visible. It seems like ProcessMonitorWindow simply needs a reference to its MainWindow. It doesn’t need to know about any other windows. I think a simple reference, ParentWindow as MainWindow, would be sufficient.[/quote]
Funny, I’d just worked up a simple test using this type of thing. I instantiate the task progress window, assign its taskParentWindow to the calling parent’s Self, open the task window, and then start a timer on the task window to hide the assigned parent.
This seems to be the easiest solution to this scenario.
I’ve got the parent and child windows sorted
Implicit is off
On startup (App.Open), I init and open a wTaskMain window
The user sets options and starts the task
The start action inits a taskProgress window but doesn’t show it
The next item after creating the New taskProgress window is to set the taskProgress.myParentWindow property to Self
The taskProgress window is shown and the task runs
The task completes and tries to communicate with myParentWindow
I get a NOE that the taskProgress.myParentWindow is NIL
When I debug and check the taskProgress Window properties, the myParentWindow IS NILL.
Here’s my code to init and show the taskProgress window:
wTaskProgress = New wIngestOperationProgress
wTaskProgress.myParentWindow = Self
wTaskProgress.Show
Self.Hide
Even though I have the taskProgress window marked as non-implicit, it is still opening as soon as I issue the New call:
wTaskProgress = New wIngestOperationProgress
This could definitely be messing things up since the following three commands are not run until after the progress tries to close the TaskProgress window.