Jump to content

Multicolumn Listbox Woes


Daklu

Recommended Posts

I'm trying to use a pair of MC Listboxes and drag-and-drop to create test sequences. One listbox has all the available steps listed, the other is where the sequence is assembled and edited. It's slowly coming around to how I want it to work, but I can't figure out how to deselect the rows in either listbox when it loses focus. I can change the selection programmatically, I'm just not sure what set of events I need to watch for before clearing the selection.

Anyone have a clue they're willing to share?

Link to comment

You might wish to ask yourself whether you actually need the lines to be deselected. Is there any harm in leaving them selected?

If not, then here are some obvious candidates:

  1. Drag end on either LB (it's possible that you would need to use the event to deselect just the other LB).
  2. Mouse up on the VI (or on all the controls in the VI minus the LB you released on).
  3. Key Down on the VI?

There may be others. This is just off the top of my head.

Link to comment

If you're asking for what I think you are, all you need to do is write -1 to the local variable of the listbox and it will deselect the row.

THAT part I got. :lol:

It's a question of *when* to write that value to get the behavior I'm looking for.

You might wish to ask yourself whether you actually need the lines to be deselected. Is there any harm in leaving them selected?

It's not harmful, but it will go a long ways toward making the UI intuitive. I've added code to keypress handlers to delete the selected rows in the sequence builder when the delete key is pressed and the listbox has focus. Unselected the rows (or changing the highlighting color) is a good visual indicator for the user to know whether the delete key will work or not.

If not, then here are some obvious candidates:

Thanks for the suggestions. I guess I'll have to intercept every event that possibly can change the focus, compare the active object to the listboxes, and set listbox value if it's not selected. I was hoping for something a little more elegant and simple, but it is what it is.

Link to comment

Thanks for the suggestions. I guess I'll have to intercept every event that possibly can change the focus, compare the active object to the listboxes, and set listbox value if it's not selected. I was hoping for something a little more elegant and simple, but it is what it is.

For the "active object" part, I would suggest having a single shift register with a "LB 1, LB2, Other" enum and just set it whenever you make a selection in one of the LBs.

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.