When you want to set new values to the private class data, you need to send these values to Murmex in order to process them. The concept is that you can update values yourself internally and you can set them externally. In LabVIEW Object Oriented Programming (LVOOP) you can set parameters of the private class data either in the class directly by Bundle By Name or wrapping this by a setter or getter.
Let us first look how to set these within the class. Important is, that these values are set within a method that is being called. For example in the Initialise method.
Setting new values internally
Setting new values externally
- Just like in Configuration and settings cluster, create a strict type cluster and save it in the virtual folder of type definitions.
- As seen in Configuration and settings cluster, update the Get settings chain, where the empty variant should be replaced by the unbundling of the settings cluster of the private class data.
- Add to the folder an accessor of your data. Click right mouse on the virtual folder accessors >> New >> Create from Static Dispatch Template. When you want to read the data e.g. frequency, call it “Get frequency”. If you want to write the data to the variable, call it e.g. “Set frequency”.
- Create a control as input and wire it to the Bundle by Name in order to store it in the private class data. Set on the front panel the newly created control as input on the Terminal block and set this input as Required.
- Give the method an appropriate icon. Use for the setters a pen and for the getters the glasses. To describe the method, use text to describe it or even better use an icon.
- In this example, add to the Initialise method the accessor.
- If you like to visualize the most current value on the GUI of the component. Use the Unbundle by Name in the consumer loop.
- When setting values from the GUI to the private class data, we need to send a message to ourselves with the new values of the parameters. In Murmex we use the method Update target. Although with this method you can update any component with new values, often this is used to update your own parameters. Add to the GUI a control, e.g. frequency.
- Add to the event structure a new case that responds on a value change.
- Add the method Update Target to this case. Use the method Get ID as recipient and use again the local variable with the class data from the message handle loop.
- Create a constant cluster for the input of the Update target and wire the output from Get ID to the targer ID. Convert your parameter to use to a variant and build an array of all the parameters you like to update. The key chains represent the names of the parameters you like to use. Keep the key chains in the same order as you build the array of values.
- Now we can send the new parameters and have to implement to receive the parameters. Override the method Update.
- For each value we would like to implement an action, we have to set it in the array of strings. We use the method ‘Look up setting’ from the UpdateMessage class. When the parameter is found, we like to implement the action to be taken.
- Add a case structure for the string and add the bundle by name. Convert the string to the data type of the parameter in the settings cluster.
- Make the Call to Parent after updating the parameters.
- In the Main method, unlike before, we like to update the control that sent the UpdateMessage. Use therefore a local variable to update to the latest value. In general it is equal, but perhaps in the future you have UpdateMessages coming from other components.