Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

MGI Panel Actor from non Panel Actor

Solved!
Go to solution

I have created a small test application using the MGI Panel Actor Framework and I have a design question.  Here is a diagram of the structure, which you can see that there are non panel actors spun off of the main panel actor. What is the best way to handle the need to launch a panel actor from a nested non-panel actor?

brian175_0-1759162499992.png

 

  1. My first attempt is to launch them as a root actors and store their enqueuer references in the calling non-panel actor.  Then to stop, I send the stop in the Stop Core.vi.  However, if I stop these root actors themselves then the calling actor enqueuer is also destroyed (perhaps some cleanup code down in the actor).  For my simple application, this is easily fixed by keeping any of these actors active until the main app is closed.
    1.  brian175_1-1759151896195.png

       

  2. I could make the non panel actor a “headless” panel actor, but would I need a dummy panel for that to work?
  3. Other ideas or best practices…

Thanks,

Brian

Brian Gangloff
DataAct Incorporated
0 Kudos
Message 1 of 9
(164 Views)

Great pictures, I have a few things that come to mind, as far as these dialogs are concerned.

 

First off, maybe the naming is confusing, but there should only be one Root Actor here. That would be your Panel Actor [Main UI].

 

Launching the Panel Actor [dialog] as a nested panel actor seems the way to go. And since they're dialogs, you may not need to send them a stop from the Non Panel Actor. This is becuase you should handle the Panel Actor [dialog] quickly, and when the dialog is done, it'll send it's Last Ack back up to Non Panel Actor with it's necessary information.

 

I also think you need to save the enqueuers of the Panel Actor [dialog]s. This is because you create them with necessary information when initializing the object, it does it's thing as a dialog (user changes it's internal state through front panel actions), then sends it's Last Ack back to the caller for the caller to then get the state of the dialog (in it's Last Ack) and the dialog is identified using it's enqueuer.

0 Kudos
Message 2 of 9
(142 Views)

The original question is how to launch a panel actor from a non panel actor.  I have updated the original diagram to show that the panels are windows and not dialog (although there could be a use case for wanting to reuse a dialog from a non panel actor.

 

The problem is that you cannot launch a nested panel from a non panel actor which this illustrates:

brian175_3-1759163228237.png

 

 

So as I explained, the option that I took was to launch a root actor

brian175_0-1759165546449.png

 

 

Once the Enqueuer is valid, we can just re-use the actor and show the FP

brian175_2-1759162880632.png

Both enqueuers are shared so information is updated and passed between these actors.

 

The only way to launch these panel actors, as nested panel actors would be to change the non panel owning actor to inherit from panel actor, which was my 2nd option.

 

Brian Gangloff
DataAct Incorporated
0 Kudos
Message 3 of 9
(126 Views)

Why can't you use the regular Launch Nested Actor instead of Launch Nested Panel Actor? A Panel Actor is still just an Actor, so it'll work with all the normal Actor Framework VI's.

0 Kudos
Message 4 of 9
(121 Views)

Oh, I see, thanks for the clarification. I hadn't ran into this before.. I don't have an immediate suggestion. (BTW update the second picture, it's a duplicate of the first picture).

I agree that launching a root actor again seems odd.. there has to be a better way.. I'll be listening

0 Kudos
Message 5 of 9
(113 Views)

BertMcMahan:  The Launch Nested Panel Actor is how the panel is registered

brian175_0-1759165736386.png

 

NathanDavis: Thanks for pointing out the mistake and thanks for taking the time to respond

Brian Gangloff
DataAct Incorporated
0 Kudos
Message 6 of 9
(105 Views)
Solution
Accepted by brian175

Ah, I understand, sorry. I missed that you had panel actors launching non-panel actors which launched more panel actors.

 

There is a VI to do this already but it's probably not where you think it is- drop in Launch Root Panel (which is polymorphic), then in the dropdown select "Any (Nested Actor)":

 

BertMcMahan_0-1759180507569.png

 

 

BertMcMahan_1-1759180530599.png

 

The Help specifies "Launches a root panel as a nested actor of a non-panel actor". So, all you need to do is change the polymorphic instance you're using and you're good to go 🙂

Message 7 of 9
(85 Views)

Thanks for pointing out the obvious!!!  I guess sometimes the answer is right in front of you.

 

Here is the correct implementation for anyone else

 

brian175_0-1759185268536.png

 

Brian Gangloff
DataAct Incorporated
0 Kudos
Message 8 of 9
(80 Views)

I'd argue it isn't that obvious... I was digging around in the framework looking for something else and just stumbled on it.

 

And having "Launch nested actor" as a function of "Launch root actor" isn't what I'd consider obvious, hah.

 

I think I'd instead have "Launch Nested Actor" be polymorphic and include this function there, as that's where you tried to use it anyway. But, then again they may've had a good reason to do it the way they did, so who knows.

 

Glad you got it working, and I'm happy I learned something new myself 🙂

0 Kudos
Message 9 of 9
(73 Views)