08-24-2016 04:03 PM
I'm trying to tidy up a common use case I have with MCLs into a nice reusable utility VI, where I'd like to allow the user to select zero, one or more items from one MCL and transfer the selected contents to another MCL. The easiest way of doing this is passing a reference to my source and destination MCLs to the subVI and then accessing the Value and ItemNames properties.
However...property nodes for strict MCL types return a Value property equal to a scalar I32, rather than the array of I32s I need for 0 or more selection modes.
There are a couple of approaches I can use here:
- Pass in the control value array from the calling VI
- Disconnect the datatype from the control, meaning Value returns a variant, then Variant to Data to the I32 Array
- Set the reference type to a generic control, then do the above
- Cast the reference to an MCL contained inside the subVI
The first one would be my long term favourite, allowing me to bundle the utility into a polymorphic VI. The second option would be my other favourite, as I know the subVI will live inside a collection of exclusive MCL utilities.
Have I missed a trick? Is there a simpler, easier way of doing this?
Solved! Go to Solution.
08-24-2016 11:39 PM
Actually you can create a polymorphic VI for each strict type you want. See the Example code attached or snippets posted.
Code for Array Type:
Code for Scalar Type:
Main VI. Notice middle is broken because of type mismatch.
Hope this helps. I can be paid in kudos and/or solutions.
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner
08-25-2016 03:00 AM
See, I'm running 2013 SP1 here.
Any MCListbox (Strict) control references that I create, regardless of the control it's created from and that control's selection mode setting, will seemingly only provide access to a scalar Value property. Hence my confusion!
08-25-2016 09:28 AM
@thoult wrote:See, I'm running 2013 SP1 here.
Any MCListbox (Strict) control references that I create, regardless of the control it's created from and that control's selection mode setting, will seemingly only provide access to a scalar Value property. Hence my confusion!
D'oh!
Turns out I dropped in a strict reference for a MCL with the correct selection mode and then unticked the Include Data Type option in the RCM. Once you've done this, trying to revert back to a strict reference type loses the original selection mode setting - hence my problem.
08-25-2016 09:48 AM
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner