NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Active Participant
jyang72211
Posts: 1,323
0 Kudos

Modify cluster without cluster

In my main VI , I have a cluster that is nested a few layers deep.  The main VI will modify the cluster and write the cluster to a file for 1000 times (the modification is different each time).  I want to give the user the ability to select which element in the cluster to modify, but I don't want to show the cluster to the user, since the cluster is confusing.  Would it be possible to ask the user to specify the name of the element?  How do I do this?  What's the best way?  Thanks! 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Trusted Enthusiast
Mark_Yedinak
Posts: 2,840

Re: Modify cluster without cluster

I would find some other more UI friendly way of showing th einformation to the user. A table perhaps. A tree. I would avoid making the user know the names of the elements and asking them to supply that. Separate your inner processing from your UI. Make the UI easy to understand for the user. Since I have no idea what your cluster is or what you are trying to do it is difficult to give you any more concrete advice.



Mark Yedinak

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Active Participant
James_R
Posts: 210

Re: Modify cluster without cluster

Try investigating XControls

 

you can make the datatype of the xcontrol your cluster and then have the freedom to make the user interface user friendly

- James

Using LV 2012 on Windows 7 64 bit
Active Participant
jyang72211
Posts: 1,323
0 Kudos

Re: Modify cluster without cluster

This program is going to be for engineering only.  At the moment, I am the only person who would use it, so supplying the element names of the cluster is not a big deal.  Attached is an approach that I thought of, but it will require me to create a lot of cases and a combo box with a lot of slection, since the real program is more complext than the example.  Is there a better way?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Trusted Enthusiast
nathand
Posts: 2,823

Re: Modify cluster without cluster

I think that what you demonstrate is the best approach.  It's boring to set up but easy to modify later if you need to add or delete an element, the intent is clear, and the code isn't complicated.  Theoretically you can flatten the cluster to a string, parse out the right section of the string, modify it, insert it back into the flattened string, and unflatten it back to a cluster, but it will take longer and be much harder to debug than the simple solution.

Trusted Enthusiast
Mark_Yedinak
Posts: 2,840

Re: Modify cluster without cluster

I tend to put a little effort into the UI even when I think it will only be used by me. It seems like somebody always wants to use it later.



Mark Yedinak

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Active Participant
jyang72211
Posts: 1,323
0 Kudos

Re: Modify cluster without cluster

XControl would be cool, but after I learned about it, I also learned to stay away from it :smileyhappy:.  It is a lot of work if I don't absolutely need it. 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Active Participant
jyang72211
Posts: 1,323
0 Kudos

Re: Modify cluster without cluster

Looking at the example code, what recommendation do you have on the UI?

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
Trusted Enthusiast
Mark_Yedinak
Posts: 2,840

Re: Modify cluster without cluster

I would probably typedef all o fyour cluster and then use th ering control like you have. However, I would have a control for each type of cluster that you have and based on the value of th ering control show/hide the appropriate controls. Use the actual cluster type as your input.



Mark Yedinak

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Active Participant
James_R
Posts: 210
0 Kudos

Re: Modify cluster without cluster

Here is a down and dirty version of an XControl that will edit a cluster

 

there are plenty of improvements that can be made in the xcontrol itself but it demonstrates the idea

- James

Using LV 2012 on Windows 7 64 bit
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page