LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Actor Framework settings dialog

Hi, I'm writing a LabVIEW application using the Actor Framework. This is the first time that I have used the framework and I need some advice regarding application architecture. My apologies if this is a basic question!

 

How is a settings dialog box best implemented? In the past in non-Actor Framework applications I have loaded the configuration from a functional global variable, displayed the settings dialog, then written the updated settings back to the functional global. I'm not sure this would work correctly (or optimally) within the context of the Actor Framework, though. 

 

My application uses the template generated by Create Project -> Actor Framework. The top-level Actor manages the user interface. Two child Actors control separate pieces of hardware. The top-level actor must read a saved configuration from an INI file when the application starts, and save the final configuration back to the INI file on exit.

 

Instinctively I think it would be best for each child actor to maintain its own settings, as a cluster in its class private data. Ideally I don't want to have to keep a separate instance of the two clusters of settings in the top-level Actor's private data in order to populate a settings dialog; this duplication seems unnecessary.

 

The only way I can think of to make this work is as follows.

 

At application start

1. Top-level Actor reads settings from INI file.

2. Send messages to both child actors with the new settings, and tell them to apply those settings to their private data.

3. Each child Actor should respond to acknowledge that the private data has been updated.

 

To update the settings using a dialog box

1. Send a message from the top-level Actor to each child Actor to ask them to send their settings to the top-level Actor.

2. Wait for both child Actors to reply.

3. Display the dialog box.

4. If the user clicked 'Ok' and not 'Cancel', send messages to both actors with the new settings, and tell them to apply those settings to their private data.

5. Each child Actor should respond to acknowledge that the private data has been updated.

 

On exit

1. Send a message from the top-level Actor to each child Actor to ask them to send their settings to the top-level Actor.

2. Wait for both child Actors to reply.

3. The top-level Actor writes the settings to the INI file.

 

This doesn't seem like a sensible approach, though. Waiting for message replies sounds like the wrong thing to do. I wouldn't know where in the block diagram to implement this scheme, either.

 

Can anyone offer me any advice? There must be a fairly standard way of doing this that I'm missing!

 

Thanks in advance,

Chris

 

---

Dr. Chris Empson

Robot Screening and Instrumentation Specialist

School of Chemistry

University of Leeds

UK

 

CLD

0 Kudos
Message 1 of 2
(3,202 Views)

Hi Chris,

Hope you’re doing well! How is your actor framework application coming along? The main understanding is that the framework is used to create highly independent processes and reduce duplicating code. With this in mind, I understand why you might think that waiting for messages may seem like the wrong thing to do. I have a couple of suggestions/questions.

 

At your application start stage, what is the nature of theses child actors? Would it in fact be possible for your child actors to read settings directly from the INI file? This way, the child actors do not have to acknowledge in any way that the data has been updated to the top level actor, and therefore reduces coupling with the top level actor. The child actors are therefore made more independent.

 

Similarly, at application start, why is it required that the top level actor ask each child actor for their settings? Am I correct in thinking that this is because you would like to display the dialog box on the top level of your application? If so, then your method outlined in your post seems perfectly acceptable for implementing such an application.

 

You may have already seen this already, but within the standard template project for the actor framework are a couple of useful documents detailing standard and best practices. I highly recommend these.

 

There is also a rather big community of actor framework users and links you can have a look at. Here they are:

 

https://decibel.ni.com/content/docs/DOC-17193

https://decibel.ni.com/content/docs/DOC-42227

https://decibel.ni.com/content/docs/DOC-18309

 

Kind regards,

 

Hashim Shamsi

0 Kudos
Message 2 of 2
(3,112 Views)