Jump to content

Creating a reference to a specific row in an array


Recommended Posts

I've found another way round for what I was trying to do, but I am still curious as to whether things could work this way.

I created an array where each row consisted of a cluster of two strings and a lower-level cluster. Each row was dynamically generated when the user wanted to add it. I wanted to pass the appropriate lower-level cluster as a reference to a subVi so it could be constantly updated, but couldn't see how to generate the reference for the cluster on the specific array row. Is this possible? Or would I have to pass a reference to the whole array, along with an index for the row I needed the subvi to interact with?

Link to comment

You can't get a reference to a specific element in a front panel array.

It might be better to not show the array 'as is' to the user. Having a table of multi column listbox together with a Functional global that holds the data and provides an edit functionality.

Ton

Link to comment

Having a table of multi column listbox together with a Functional global that holds the data and provides an edit functionality.

unsure.gifunsure.gifunsure.gif

As a friend of mine used to say "I think I understand all the words in the sentence, but the overall meaning escapes me".

Could you please explain in a bit more detail what you are suggesting?

Link to comment
  • 5 weeks later...

Hi!

I also tried multi column listbox but they haven't got extra functionailties. You can't easily add combobox, path and other columns. So an alternativ is to use array. But they are alse very limited. If u change a propertie of the control it changes everywhere. You can't change a color in one row. And can't use Xcontrol in arrays.

I made a little discovery yesterday i can get a reference to the clicked arrayelement. So i can change the value easily. But i don't know why it works because i put a probe on the reference it points every time to the same.

ClickedArrayElementRef.vi

Link to comment

Hi!

I also tried multi column listbox but they haven't got extra functionailties. You can't easily add combobox, path and other columns. So an alternativ is to use array. But they are alse very limited. If u change a propertie of the control it changes everywhere. You can't change a color in one row. And can't use Xcontrol in arrays.

I made a little discovery yesterday i can get a reference to the clicked arrayelement. So i can change the value easily. But i don't know why it works because i put a probe on the reference it points every time to the same.

I have only found one method that lets me get at a specific element in an array via control refs.

It is very convoluted but I posted code and talked about in this Nugget on the Dark-side.

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=267659#M267659

At the very least a review of that Nugget will show you just how complicated it is to get at an array element.

Ben

Link to comment

I made a little discovery yesterday i can get a reference to the clicked arrayelement. So i can change the value easily. But i don't know why it works because i put a probe on the reference it points every time to the same.

The reference is the same every time because it is pointing to the same string element on the front panel, rather than a specific element of the array. Try this - have the array counter set on 0 so you can see your "a" "b" and "c". Click on C. Then change the array counter up to 2 (so "c" is in the top box). Click on the "write text" button and the text is still written in the 3rd box, rather than overwriting the "c" and becomes the 5th element (index 4) not the third.

Ben - thanks, that's given me a couple of thoughts on things to try .....

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.