07-24-2015 05:57 AM
I have actor for each the popup windows in my system and I don't want 2 of the same popup on screen.
Lets say I have a Configure Test Popup. If press "Configure Test" button on my main application (the caller) and it launches the Configure Test Popup nested actor. The Test Popup actor stays on screen.
If I press the "Configure Test" button again whilst the popup is still on screen, I don't want another popup to be displayed.
If I have closed the Configure Test Popup then I do want another nested actor to be launched when I press the "Configure Test".
At the moment, I have a message for my caller that launches the popup and stores the Enqueuer.
I have tried using the "Message Enqueuer:Equals Not A Refnum" and only launch if it is a valid refnum. this doesn't work because it stays valid even once the Actor has closed.
I was thinking about using the Last Ack so I know once the actor has closed and whether to re-launch or not.
Any thoughts would be great.
Cheers
Lewis
Solved! Go to Solution.
07-24-2015 06:53 AM
I could also always have the popup actos running and then have a show/hide method. To close the front panel or show the front panel.
I think this might be the best
07-24-2015 06:57 AM
Some options:
07-24-2015 10:30 AM
Here is what I would do.
Store a boolean in the caller for whether the nested actor is launched. When you receive a request to launch the nested actor only launch if the boolean is false. When you launch set it to True. When you receive last ack set it back to false.
Casey
Phoenix, LLC
CLA, LabVIEW Champion
Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!
07-24-2015 01:35 PM
Lewis_G wrote:
...this doesn't work because it stays valid even once the Actor has closed.
The message queue should die with the Actor, so this should work (unless there is a bug somewhere).
-- James
07-25-2015 04:46 PM
drjdpowell wrote:
The message queue should die with the Actor, so this should work (unless there is a bug somewhere).
I haven't tested, but all the VI does is compare the enqueuer to a constant. Presumably any initialized NQR is different from the constant, even if it was closed (since it's simply by-value).
07-26-2015
06:43 PM
- last edited on
11-06-2024
12:02 PM
by
Content Cleaner
tst wrote:
I haven't tested, but all the VI does is compare the enqueuer to a constant. Presumably any initialized NQR is different from the constant, even if it was closed (since it's simply by-value).
That's not consistant with what "Not a Refum" means for other LabVIEW references. A dead Queue/Notifier/DVR/etc. is is "Not a Refnum" even if it is a non-zero number.
07-27-2015
12:39 AM
- last edited on
11-06-2024
12:04 PM
by
Content Cleaner
drjdpowell, this is correct. "Not a refnum" for NQRs is not consistent with other LabVIEW references. It says so in the documentation:
This function only checks whether Message Enqueuer is equal to Not a Refnum. It does not check whether Message Enqueuer still is valid because doing so can introduce a race condition into the application. It is possible for a refnum to become invalid after being declared valid but before a message is sent to it.
07-27-2015 06:16 AM
Yes, I can confirm that this does not work..
You do get an error when you send the Stop message because the Enqueuer is no longer valid (if I have shut down the nested actor). So the only way to do it would be to send a message that does nothing? If it doesn't error on the Enqueue then the actor is running. If it does error, the actor has been stopped.
07-27-2015 10:32 AM
The solution I've gone for in the end is having a parent actor which has a Launch Abstract Popup Method and Overrides Handle Last Ack.
Launch:
Handle Last Ack.
Stop Core also shutdowns any popups left open.
This seems to work really well. Any actor that overrides my process actor can launch a popup and not worry about keeping track of references.
thanks for the help