Jump to content

Dual Listbox XControl Issue


Recommended Posts

I am trying to create a dual listbox xcontrol that will allow you to move an item from listbox to listbox. My intention is to have one listbox have "parts" of the other listbox for configuration purposes.

So basically, you select an item in the left hand list box (see vi's), press the right arrow, and the item "moves" over to the righ thand listbox. This is a similiar action to what NI does in the build specifications where you add vis to the startup vi's listbox.

I attached my xcontrol, as I cant seem to get any of the items to go anywhere. I am sure I am missing something so very simple.

Thanks.

Link to comment

A common misconception (and a mistake I still make) is to think that by toggling the "Data Change" boolean, you are telling the Xcontrol to execute the "Data Change" event case. The "Data Change" event case only executes when the value terminal is written to by wiring (or using property nodes, or local variables) to the Xcontrol itself on the VI it was placed on.

As far as I know, toggling the "Data Change" boolean value in the Action cluster (and someone will correct me if I'm wrong here) will tell LabVIEW to refresh the control values that were loaded inside the Xcontrol. Think of it as a flag for "hey, one of my internal controls has changed it's value." or "Refresh, please."

So to make this all work for your application, you would either use local variables to load the two listboxes with their respective values inside each case in which you want to modify them (left/right arrow value change), or perhaps simply move the code that you have in the "Data Change" event case to the "Timeout" case, since that case always executes.

I'm no expert when it comes to Xcontrols, but I have had the same problem you had and that is how I was able to get around it. Others may have better suggestions. ;)

Link to comment

QUOTE (dblk22vball @ Nov 25 2008, 08:19 PM)

I attached my xcontrol, as I cant seem to get any of the items to go anywhere. I am sure I am missing something so very simple.

You should use the listbox's Value instead of the Active Row property.. The latter one serves a different purpose (setting/getting row specific attributes, also see Ctrl-h when you hover over the property.)

I also recommend you use the Value Change events (for both the listbox and booleans) to detect the value change. That's what it's for and I think it's the only way to know for sure you have the correct (updated) value at your disposal.

Link to comment

QUOTE (jdunham @ Nov 25 2008, 02:58 PM)

DOH :worship:

I totally forgot that they have to be the same length.....

The cluster idea is working much better (I modified the xcontrol to use that). I just have an issue with getting the correct row that I clicked on, but I should be able to get that. Thanks.

QUOTE (Jeffrey Habets @ Nov 25 2008, 03:17 PM)

You should use the listbox's
Value
instead of the
Active Row
property.. The latter one serves a different purpose (setting/getting row specific attributes, also see Ctrl-h when you hover over the property.)

That did help in getting me the right row.

For some reason it will not store the correct row though. It always defaults to 0, instead of the selected row. I attached my updated vi's.

I tried updating the row in the Data and Display clusters, but it does not seem to be saved for some reason.......

Link to comment

QUOTE (dblk22vball @ Nov 25 2008, 10:40 PM)

For some reason it will not store the correct row though. It always defaults to 0, instead of the selected row. I attached my updated vi's.

I tried updating the row in the Data and Display clusters, but it does not seem to be saved for some reason.......

In your Listbox Value Change you need to tell LV that your state and display data has changed (as you do when you handle the button clicks).

To make it even simpler I would simply read the values of the listbox when the buttons are clicked. No reason to save the rows in your state and/or display date in this case.

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.